diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-01-06 18:58:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-01-06 18:58:10 +0000 |
commit | 789140d611b6221d8a1c230cc02cfd46c9229633 (patch) | |
tree | 2d1d423c3505710e01c067cd9171c1c68ab96a75 /main/src/test | |
parent | 8155b26b1a3d53767debab3d99f973b9008fdcb5 (diff) | |
parent | 6cf781f89ada83ec5e317745b8b92086b96d27ac (diff) |
Merge "Changed identifiers to concept identifiers"
Diffstat (limited to 'main/src/test')
19 files changed, 183 insertions, 165 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/MultiPdpStatusListenerTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/MultiPdpStatusListenerTest.java index 9cef0c95..4f276a90 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/MultiPdpStatusListenerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/MultiPdpStatusListenerTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +34,6 @@ import org.junit.Test; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.models.pdp.concepts.PdpResponseDetails; import org.onap.policy.models.pdp.concepts.PdpStatus; -import org.onap.policy.pap.main.comm.MultiPdpStatusListener; public class MultiPdpStatusListenerTest { private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java index a8c47043..1fdbfe65 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,7 @@ import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.enums.PdpHealthStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.pap.main.parameters.PdpParameters; import org.onap.policy.pap.main.rest.e2e.End2EndBase; @@ -72,8 +72,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status1.setPdpGroup(DEFAULT_GROUP); status1.setPdpType(APEX_TYPE); status1.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents1 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents1 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status1.setPolicies(idents1); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status1); verifyPdpGroup(DEFAULT_GROUP, 1); @@ -86,8 +86,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status2.setPdpType(APEX_TYPE); status2.setHealthy(PdpHealthStatus.HEALTHY); status2.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents2 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents2 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status2.setPolicies(idents2); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status2); verifyPdpGroup(DEFAULT_GROUP, 1); @@ -100,8 +100,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status3.setPdpType(APEX_TYPE); status3.setHealthy(PdpHealthStatus.HEALTHY); status3.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents3 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents3 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status3.setPolicies(idents3); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status3); verifyPdpGroup(DEFAULT_GROUP, 2); @@ -113,8 +113,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status4.setPdpGroup("wrongGroup"); status4.setPdpType(APEX_TYPE); status4.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents4 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents4 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status4.setPolicies(idents4); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status4); verifyPdpGroup(DEFAULT_GROUP, 2); @@ -127,8 +127,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status5.setPdpType(APEX_TYPE); status5.setHealthy(PdpHealthStatus.HEALTHY); status5.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents5 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents5 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status5.setPolicies(idents5); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status5); verifyPdpGroup(DEFAULT_GROUP, 2); @@ -141,9 +141,9 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status6.setPdpType(APEX_TYPE); status6.setHealthy(PdpHealthStatus.HEALTHY); status6.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents6 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION), - new ToscaPolicyIdentifier("onap.restart.tca", POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents6 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION), + new ToscaConceptIdentifier("onap.restart.tca", POLICY_VERSION)); status6.setPolicies(idents6); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status6); verifyPdpGroup(DEFAULT_GROUP, 2); @@ -168,8 +168,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status7b.setPdpType(APEX_TYPE); status7b.setPdpSubgroup(APEX_TYPE); status7b.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents7b = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents7b = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status7b.setPolicies(idents7b); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status7b); verifyPdpGroup(DEFAULT_GROUP, 2); @@ -182,8 +182,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status8.setPdpType(APEX_TYPE); status8.setPdpSubgroup(APEX_TYPE); status8.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents8 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents8 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status8.setPolicies(idents8); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status8); verifyPdpGroup(DEFAULT_GROUP, 1); @@ -196,8 +196,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status9.setPdpType(APEX_TYPE); status9.setPdpSubgroup(APEX_TYPE); status9.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents9 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents9 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status9.setPolicies(idents9); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status9); verifyPdpGroup(DEFAULT_GROUP, 0); @@ -216,8 +216,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status1.setPdpGroup(DEFAULT_GROUP); status1.setPdpType(APEX_TYPE); status1.setHealthy(PdpHealthStatus.HEALTHY); - final List<ToscaPolicyIdentifier> idents1 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents1 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status1.setPolicies(idents1); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status1); verifyPdpGroup(DEFAULT_GROUP, 1); @@ -230,8 +230,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status2.setPdpType(APEX_TYPE); status2.setHealthy(PdpHealthStatus.HEALTHY); status2.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents2 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents2 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status2.setPolicies(idents2); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status2); @@ -243,8 +243,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status3.setPdpType(APEX_TYPE); status3.setHealthy(PdpHealthStatus.HEALTHY); status3.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents3 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents3 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status3.setPolicies(idents3); PdpStatistics pdpStatistics03 = new PdpStatistics(); @@ -264,8 +264,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status4.setPdpType(APEX_TYPE); status4.setHealthy(PdpHealthStatus.HEALTHY); status4.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents4 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents4 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status4.setPolicies(idents4); status4.setStatistics(null); pdpHeartbeatListener.onTopicEvent(INFRA, TOPIC, status4); @@ -279,8 +279,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status5.setPdpType(APEX_TYPE); status5.setHealthy(PdpHealthStatus.HEALTHY); status5.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents5 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents5 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status5.setPolicies(idents5); PdpStatistics pdpStatistics05 = new PdpStatistics(); @@ -301,8 +301,8 @@ public class PdpHeartbeatListenerTest extends End2EndBase { status6.setPdpType(APEX_TYPE); status6.setHealthy(PdpHealthStatus.HEALTHY); status6.setPdpSubgroup(APEX_TYPE); - final List<ToscaPolicyIdentifier> idents6 = - Arrays.asList(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION)); + final List<ToscaConceptIdentifier> idents6 = + Arrays.asList(new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION)); status5.setPolicies(idents6); PdpStatistics pdpStatistics06 = new PdpStatistics(); diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java index 3a35370b..114d50e6 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,8 +59,8 @@ import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.pdp.enums.PdpState; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; import org.onap.policy.pap.main.comm.msgdata.Request; import org.onap.policy.pap.main.comm.msgdata.RequestListener; import org.onap.policy.pap.main.parameters.PdpModifyRequestMapParams; @@ -86,7 +86,7 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { * Used to capture input to undeployer.undeploy(). */ @Captor - private ArgumentCaptor<Collection<ToscaPolicyIdentifier>> undeployCaptor; + private ArgumentCaptor<Collection<ToscaConceptIdentifier>> undeployCaptor; @Mock private PdpRequests requests; @@ -547,7 +547,7 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { @Test public void testSingletonListenerFailureUndeploy() throws Exception { - ToscaPolicyIdentifier ident = new ToscaPolicyIdentifier("undeployed", "2.3.4"); + ToscaConceptIdentifier ident = new ToscaConceptIdentifier("undeployed", "2.3.4"); ToscaPolicy policy = mock(ToscaPolicy.class); when(policy.getIdentifier()).thenReturn(ident); @@ -592,7 +592,7 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { @Test public void testSingletonListenerFailureUndeployMessageUnchanged() throws Exception { - ToscaPolicyIdentifier ident = new ToscaPolicyIdentifier("msg-unchanged", "8.7.6"); + ToscaConceptIdentifier ident = new ToscaConceptIdentifier("msg-unchanged", "8.7.6"); ToscaPolicy policy = mock(ToscaPolicy.class); when(policy.getIdentifier()).thenReturn(ident); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonSupport.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonSupport.java index 14f3055c..de1848d4 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonSupport.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonSupport.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +25,7 @@ import java.util.Arrays; import java.util.List; import org.junit.Before; import org.onap.policy.models.pap.concepts.PolicyStatus; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Super class for policy notification test classes. @@ -37,22 +37,22 @@ public class PolicyCommonSupport { protected static final String PDP3 = "pdp-3"; protected static final String PDP4 = "pdp-4"; - protected ToscaPolicyTypeIdentifier type; - protected ToscaPolicyIdentifier policy1; - protected ToscaPolicyIdentifier policy2; - protected ToscaPolicyIdentifier policy3; - protected ToscaPolicyIdentifier policy4; + protected ToscaConceptIdentifier type; + protected ToscaConceptIdentifier policy1; + protected ToscaConceptIdentifier policy2; + protected ToscaConceptIdentifier policy3; + protected ToscaConceptIdentifier policy4; /** * Creates various objects. */ @Before public void setUp() { - type = new ToscaPolicyTypeIdentifier("my-type", "3.2.1"); - policy1 = new ToscaPolicyIdentifier("my-id-a", "1.2.0"); - policy2 = new ToscaPolicyIdentifier("my-id-b", "1.2.1"); - policy3 = new ToscaPolicyIdentifier("my-id-c", "1.2.2"); - policy4 = new ToscaPolicyIdentifier("my-id-d", "1.2.3"); + type = new ToscaConceptIdentifier("my-type", "3.2.1"); + policy1 = new ToscaConceptIdentifier("my-id-a", "1.2.0"); + policy2 = new ToscaConceptIdentifier("my-id-b", "1.2.1"); + policy3 = new ToscaConceptIdentifier("my-id-c", "1.2.2"); + policy4 = new ToscaConceptIdentifier("my-id-d", "1.2.3"); } /** @@ -62,7 +62,7 @@ public class PolicyCommonSupport { * @param pdps PDPs to be included within the data * @return a new notification data structure */ - protected PolicyPdpNotificationData makeData(ToscaPolicyIdentifier policyId, String... pdps) { + protected PolicyPdpNotificationData makeData(ToscaConceptIdentifier policyId, String... pdps) { PolicyPdpNotificationData data = new PolicyPdpNotificationData(policyId, type); data.addAll(Arrays.asList(pdps)); return data; diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java index 34d4db60..b80b80d7 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,17 +38,18 @@ import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.onap.policy.models.pap.concepts.PolicyStatus; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.powermock.reflect.Whitebox; public class PolicyCommonTrackerTest extends PolicyCommonSupport { private MyTracker tracker; - private Map<ToscaPolicyIdentifier, PolicyTrackerData> map; + private Map<ToscaConceptIdentifier, PolicyTrackerData> map; /** * Creates various objects, including {@link #tracker}. */ + @Override @Before public void setUp() { super.setUp(); @@ -73,24 +75,24 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { tracker.addData(makeData(policy1, PDP1, PDP2)); tracker.addData(makeData(policy2, PDP2)); - policy3 = new ToscaPolicyIdentifier(policy1.getName(), policy1.getVersion() + "0"); + policy3 = new ToscaConceptIdentifier(policy1.getName(), policy1.getVersion() + "0"); tracker.addData(makeData(policy3, PDP3)); List<PolicyStatus> statusList = tracker.getStatus(policy1.getName()); assertEquals(2, statusList.size()); - Set<ToscaPolicyIdentifier> idents = + Set<ToscaConceptIdentifier> idents = statusList.stream().map(PolicyStatus::getPolicy).collect(Collectors.toSet()); assertTrue(idents.contains(policy1)); assertTrue(idents.contains(policy3)); } @Test - public void testGetStatusToscaPolicyIdentifier() { + public void testGetStatusToscaConceptIdentifier() { tracker.addData(makeData(policy1, PDP1, PDP2)); tracker.addData(makeData(policy2, PDP2)); - policy3 = new ToscaPolicyIdentifier(policy1.getName(), policy1.getVersion() + "0"); + policy3 = new ToscaConceptIdentifier(policy1.getName(), policy1.getVersion() + "0"); tracker.addData(makeData(policy3, PDP3)); Optional<PolicyStatus> status = tracker.getStatus(policy1); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java index 1305f27e..5e64c939 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,9 +51,8 @@ import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.provider.PolicyModelsProvider; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper; import org.onap.policy.pap.main.PolicyPapRuntimeException; import org.onap.policy.pap.main.comm.Publisher; @@ -95,6 +95,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { /** * Creates various objects, including {@link #notifier}. */ + @Override @Before public void setUp() { MockitoAnnotations.initMocks(this); @@ -122,7 +123,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { when(dao.getPdpGroups(null)).thenReturn(Arrays.asList(group1, group2)); - ToscaPolicyTypeIdentifier type2 = new ToscaPolicyTypeIdentifier("my other type", "8.8.8"); + ToscaConceptIdentifier type2 = new ToscaConceptIdentifier("my other type", "8.8.8"); // note: no mapping for policy4 when(dao.getFilteredPolicyList(any())).thenReturn(Arrays.asList(makePolicy(policy1, type), @@ -159,7 +160,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { assertEquals("[sub #2 A 0]", data.getPdps().toString()); } - private ToscaPolicy makePolicy(ToscaPolicyIdentifier policyId, ToscaPolicyTypeIdentifier type) { + private ToscaPolicy makePolicy(ToscaConceptIdentifier policyId, ToscaConceptIdentifier type) { ToscaPolicy policy = new ToscaPolicy(); policy.setName(policyId.getName()); @@ -179,7 +180,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { return group; } - private PdpSubGroup makeSubGroup(String name, int numPdps, ToscaPolicyIdentifier... policies) { + private PdpSubGroup makeSubGroup(String name, int numPdps, ToscaConceptIdentifier... policies) { final PdpSubGroup subgrp = new PdpSubGroup(); subgrp.setPdpType(name); subgrp.setPdpInstances(new ArrayList<>(numPdps)); @@ -213,7 +214,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { } @Test - public void testGetStatusToscaPolicyIdentifier() { + public void testGetStatusToscaConceptIdentifier() { Optional<PolicyStatus> status = Optional.of(status1); when(deploy.getStatus(policy1)).thenReturn(status); @@ -243,7 +244,7 @@ public class PolicyNotifierTest extends PolicyCommonSupport { doAnswer(addStatus(2, status1, status2)).when(deploy).processResponse(eq(PDP1), any(), any()); doAnswer(addStatus(2, status3, status4)).when(undeploy).processResponse(eq(PDP1), any(), any()); - List<ToscaPolicyIdentifier> activePolicies = Arrays.asList(policy1, policy2); + List<ToscaConceptIdentifier> activePolicies = Arrays.asList(policy1, policy2); notifier.processResponse(PDP1, activePolicies); PolicyNotification notification = getNotification(); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyPdpNotificationDataTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyPdpNotificationDataTest.java index cd8b4d32..67a3cb1f 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyPdpNotificationDataTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyPdpNotificationDataTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +31,7 @@ import java.util.Collections; import java.util.TreeSet; import org.junit.Before; import org.junit.Test; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Note: this wraps the PDPs in a TreeSet so that the content can be verified without @@ -43,8 +43,8 @@ public class PolicyPdpNotificationDataTest { private static final String PDP3 = "pdp-3"; private static final String PDP4 = "pdp-4"; - private ToscaPolicyIdentifier policyId; - private ToscaPolicyTypeIdentifier policyType; + private ToscaConceptIdentifier policyId; + private ToscaConceptIdentifier policyType; private PolicyPdpNotificationData data; /** @@ -52,8 +52,8 @@ public class PolicyPdpNotificationDataTest { */ @Before public void setUp() { - policyId = new ToscaPolicyIdentifier("my-id", "1.2.3"); - policyType = new ToscaPolicyTypeIdentifier("my-type", "3.2.1"); + policyId = new ToscaConceptIdentifier("my-id", "1.2.3"); + policyType = new ToscaConceptIdentifier("my-type", "3.2.1"); data = new PolicyPdpNotificationData(policyId, policyType); } diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyTrackerDataTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyTrackerDataTest.java index ff797809..2d27b75e 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyTrackerDataTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyTrackerDataTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +32,11 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.onap.policy.models.pap.concepts.PolicyStatus; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class PolicyTrackerDataTest { - private static final ToscaPolicyTypeIdentifier TYPE = new ToscaPolicyTypeIdentifier("my-type", "1.2.3"); + private static final ToscaConceptIdentifier TYPE = new ToscaConceptIdentifier("my-type", "1.2.3"); private static final String PDP1 = "pdp-1"; private static final String PDP2 = "pdp-2"; private static final String PDP3 = "pdp-3"; diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java index fc3bc626..a753db1e 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; @@ -478,7 +478,7 @@ public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper { when(dao.getPdpGroups(group.getName())).thenReturn(Arrays.asList(group)); newgrp.getPdpSubgroups().get(0).getSupportedPolicyTypes() - .add(new ToscaPolicyTypeIdentifier("typeX.*", "9.8.7")); + .add(new ToscaConceptIdentifier("typeX.*", "9.8.7")); // the group is updated with a new supported policy type in subgroup assertEquals(2, newgrp.getPdpSubgroups().get(0).getSupportedPolicyTypes().size()); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java index 250b9678..99aa3542 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteProvider.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,8 +51,8 @@ import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; import org.onap.policy.pap.main.rest.ProviderBase.Updater; public class TestPdpGroupDeleteProvider extends ProviderSuper { @@ -66,9 +66,9 @@ public class TestPdpGroupDeleteProvider extends ProviderSuper { private ArgumentCaptor<Set<String>> pdpCaptor; private MyProvider prov; - private ToscaPolicyIdentifierOptVersion optIdent; - private ToscaPolicyIdentifierOptVersion fullIdent; - private ToscaPolicyIdentifier ident; + private ToscaConceptIdentifierOptVersion optIdent; + private ToscaConceptIdentifierOptVersion fullIdent; + private ToscaConceptIdentifier ident; private Updater updater; @@ -89,8 +89,8 @@ public class TestPdpGroupDeleteProvider extends ProviderSuper { super.setUp(); ident = policy1.getIdentifier(); - optIdent = new ToscaPolicyIdentifierOptVersion(ident.getName(), null); - fullIdent = new ToscaPolicyIdentifierOptVersion(ident.getName(), ident.getVersion()); + optIdent = new ToscaConceptIdentifierOptVersion(ident.getName(), null); + fullIdent = new ToscaConceptIdentifierOptVersion(ident.getName(), ident.getVersion()); prov = new MyProvider(); @@ -292,7 +292,7 @@ public class TestPdpGroupDeleteProvider extends ProviderSuper { } @Override - protected void processPolicy(SessionData data, ToscaPolicyIdentifierOptVersion desiredPolicy) + protected void processPolicy(SessionData data, ToscaConceptIdentifierOptVersion desiredPolicy) throws PfModelException { // do nothing } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java index 739a5f38..f2d33374 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,7 +35,7 @@ import org.onap.policy.models.pap.concepts.PdpGroupDeployResponse; import org.onap.policy.models.pdp.concepts.DeploymentGroup; import org.onap.policy.models.pdp.concepts.DeploymentGroups; import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; /** * Note: this tests failure cases; success cases are tested by tests in the "e2e" package. @@ -104,8 +104,8 @@ public class TestPdpGroupDeployControllerV1 extends CommonPapRestServer { } private Entity<PdpDeployPolicies> makePdpPoliciesEntity() { - ToscaPolicyIdentifierOptVersion pol1 = new ToscaPolicyIdentifierOptVersion("policy-a", "1"); - ToscaPolicyIdentifierOptVersion pol2 = new ToscaPolicyIdentifierOptVersion("policy-b", null); + ToscaConceptIdentifierOptVersion pol1 = new ToscaConceptIdentifierOptVersion("policy-a", "1"); + ToscaConceptIdentifierOptVersion pol2 = new ToscaConceptIdentifierOptVersion("policy-b", null); PdpDeployPolicies policies = new PdpDeployPolicies(); policies.setPolicies(Arrays.asList(pol1, pol2)); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java index db320b5c..b6763008 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployProvider.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -53,8 +54,8 @@ import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.concepts.PdpUpdate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; import org.onap.policy.pap.main.notification.PolicyPdpNotificationData; public class TestPdpGroupDeployProvider extends ProviderSuper { @@ -85,6 +86,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { * * @throws Exception if an error occurs */ + @Override @Before public void setUp() throws Exception { @@ -107,9 +109,9 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { when(dao.getPdpGroups(dbgroup.getName())).thenReturn(Arrays.asList(dbgroup)); // add new policies - List<ToscaPolicyIdentifier> policies = newgrp.getPdpSubgroups().get(0).getPolicies(); - policies.add(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION)); - policies.add(new ToscaPolicyIdentifier(POLICY3_NAME, POLICY3_VERSION)); + List<ToscaConceptIdentifier> policies = newgrp.getPdpSubgroups().get(0).getPolicies(); + policies.add(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION)); + policies.add(new ToscaConceptIdentifier(POLICY3_NAME, POLICY3_VERSION)); when(dao.getFilteredPolicyList(any())).thenReturn(loadPolicies("createGroupNewPolicy.json")) .thenReturn(loadPolicies("createGroupNewPolicy2.json")) @@ -134,15 +136,15 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { PdpGroup newgrp = groups.getGroups().get(0); // additional policies in the DB that will be removed - List<ToscaPolicyIdentifier> policies = newgrp.getPdpSubgroups().get(0).getPolicies(); - policies.add(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION)); - policies.add(new ToscaPolicyIdentifier(POLICY3_NAME, POLICY3_VERSION)); + List<ToscaConceptIdentifier> policies = newgrp.getPdpSubgroups().get(0).getPolicies(); + policies.add(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION)); + policies.add(new ToscaConceptIdentifier(POLICY3_NAME, POLICY3_VERSION)); PdpGroup dbgroup = new PdpGroup(newgrp); when(dao.getPdpGroups(dbgroup.getName())).thenReturn(Arrays.asList(dbgroup)); // policy that should be left - final ToscaPolicyIdentifier policyId1 = policies.remove(0); + final ToscaConceptIdentifier policyId1 = policies.remove(0); when(dao.getFilteredPolicyList(any())).thenReturn(loadPolicies("createGroupNewPolicy.json")) .thenReturn(loadPolicies("createGroupNewPolicy2.json")) @@ -171,24 +173,24 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { PdpSubGroup subgrp = newgrp.getPdpSubgroups().get(0); // put policy3 into db subgroup - subgrp.getPolicies().add(new ToscaPolicyIdentifier(POLICY3_NAME, POLICY3_VERSION)); + subgrp.getPolicies().add(new ToscaConceptIdentifier(POLICY3_NAME, POLICY3_VERSION)); PdpGroup dbgroup = new PdpGroup(newgrp); when(dao.getPdpGroups(dbgroup.getName())).thenReturn(Arrays.asList(dbgroup)); // now make the subgrp reflect our final expectation subgrp.getPolicies().remove(1); - subgrp.getPolicies().add(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION)); + subgrp.getPolicies().add(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION)); // indicate policy2 being added and policy3 being deleted DeploymentSubGroup depsub1 = new DeploymentSubGroup(); depsub1.setAction(Action.POST); depsub1.setPdpType(subgrp.getPdpType()); - depsub1.setPolicies(Arrays.asList(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION))); + depsub1.setPolicies(Arrays.asList(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION))); DeploymentSubGroup depsub2 = new DeploymentSubGroup(); depsub2.setAction(Action.DELETE); depsub2.setPdpType(subgrp.getPdpType()); - depsub2.setPolicies(Arrays.asList(new ToscaPolicyIdentifier(POLICY3_NAME, POLICY3_VERSION))); + depsub2.setPolicies(Arrays.asList(new ToscaConceptIdentifier(POLICY3_NAME, POLICY3_VERSION))); DeploymentGroup depgroup = new DeploymentGroup(); depgroup.setName(newgrp.getName()); @@ -215,7 +217,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { when(dao.getPdpGroups(group.getName())).thenReturn(Arrays.asList(group)); // something different in this subgroup - group.getPdpSubgroups().get(0).getPolicies().add(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION)); + group.getPdpSubgroups().get(0).getPolicies().add(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION)); prov.updateGroupPolicies(toDeploymentGroups(groups)); @@ -290,7 +292,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { when(dao.getPdpGroups(group.getName())).thenReturn(Arrays.asList(group)); // something different in this subgroup - group.getPdpSubgroups().get(0).getPolicies().add(new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION)); + group.getPdpSubgroups().get(0).getPolicies().add(new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION)); prov.updateGroupPolicies(toDeploymentGroups(groups)); @@ -334,10 +336,10 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { when(dao.getPdpGroups(group.getName())).thenReturn(Arrays.asList(group)); // add two new policies - ToscaPolicyIdentifier policyId2 = new ToscaPolicyIdentifier(POLICY2_NAME, POLICY2_VERSION); + ToscaConceptIdentifier policyId2 = new ToscaConceptIdentifier(POLICY2_NAME, POLICY2_VERSION); subgrp.getPolicies().add(policyId2); - ToscaPolicyIdentifier policyId3 = new ToscaPolicyIdentifier(POLICY3_NAME, POLICY3_VERSION); + ToscaConceptIdentifier policyId3 = new ToscaConceptIdentifier(POLICY3_NAME, POLICY3_VERSION); subgrp.getPolicies().add(policyId3); when(dao.getFilteredPolicyList(any())).thenReturn(loadPolicies("createGroupNewPolicy.json")) @@ -374,7 +376,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { // use version prefix PdpSubGroup subgrp = newgrp.getPdpSubgroups().get(0); - ToscaPolicyIdentifier ident = subgrp.getPolicies().get(0); + ToscaConceptIdentifier ident = subgrp.getPolicies().get(0); String version = ident.getVersion(); ident.setVersion("1"); @@ -649,7 +651,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { assertEquals(subgrp.getPdpType(), pdpUpdate.getPdpSubgroup()); - List<ToscaPolicyIdentifier> pdpPolicies = + List<ToscaConceptIdentifier> pdpPolicies = pdpUpdate.getPolicies().stream().map(ToscaPolicy::getIdentifier).collect(Collectors.toList()); Collections.sort(pdpPolicies); @@ -659,7 +661,7 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { assertEquals(Arrays.asList(group), updates); } - private void assertDeploymentData(PolicyPdpNotificationData data, ToscaPolicyIdentifier policyId, + private void assertDeploymentData(PolicyPdpNotificationData data, ToscaConceptIdentifier policyId, String expectedPdps) { assertEquals(policyId, data.getPolicyId()); assertEquals(policy1.getTypeIdentifier(), data.getPolicyType()); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java index 1a54fe5f..9ae64452 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyUndeployerImpl.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ package org.onap.policy.pap.main.rest; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -42,7 +43,7 @@ import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpSubGroup; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class TestPolicyUndeployerImpl extends ProviderSuper { private static final String MY_GROUP = "my-group"; @@ -56,10 +57,10 @@ public class TestPolicyUndeployerImpl extends ProviderSuper { @Captor private ArgumentCaptor<Set<String>> pdpCaptor; - private ToscaPolicyIdentifier ident1; - private ToscaPolicyIdentifier ident2; - private ToscaPolicyIdentifier ident3; - private ToscaPolicyIdentifier ident4; + private ToscaConceptIdentifier ident1; + private ToscaConceptIdentifier ident2; + private ToscaConceptIdentifier ident3; + private ToscaConceptIdentifier ident4; private PdpGroup group; private PdpSubGroup subgroup; private MyProvider prov; @@ -75,15 +76,16 @@ public class TestPolicyUndeployerImpl extends ProviderSuper { * * @throws Exception if an error occurs */ + @Override @Before public void setUp() throws Exception { super.setUp(); - ident1 = new ToscaPolicyIdentifier("ident-a", "2.3.1"); - ident2 = new ToscaPolicyIdentifier("ident-b", "2.3.2"); - ident3 = new ToscaPolicyIdentifier("ident-c", "2.3.3"); - ident4 = new ToscaPolicyIdentifier("ident-d", "2.3.4"); + ident1 = new ToscaConceptIdentifier("ident-a", "2.3.1"); + ident2 = new ToscaConceptIdentifier("ident-b", "2.3.2"); + ident3 = new ToscaConceptIdentifier("ident-c", "2.3.3"); + ident4 = new ToscaConceptIdentifier("ident-d", "2.3.4"); group = new PdpGroup(); group.setName(MY_GROUP); @@ -131,7 +133,7 @@ public class TestPolicyUndeployerImpl extends ProviderSuper { */ @Test public void testUndeployPoliciesUnchanged() throws PfModelException { - List<ToscaPolicyIdentifier> origlist = Arrays.asList(ident3, ident4); + List<ToscaConceptIdentifier> origlist = Arrays.asList(ident3, ident4); subgroup.setPolicies(new LinkedList<>(origlist)); prov.undeploy(MY_GROUP, MY_SUBGROUP, Arrays.asList(ident1, ident2)); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java index 818237d5..060173bb 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -44,12 +45,13 @@ import org.mockito.ArgumentCaptor; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.pap.concepts.PapPolicyIdentifier; import org.onap.policy.models.pap.concepts.PdpDeployPolicies; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpUpdate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion; import org.onap.policy.pap.main.notification.PolicyPdpNotificationData; import org.powermock.reflect.Whitebox; @@ -82,6 +84,7 @@ public class TestProviderBase extends ProviderSuper { * * @throws Exception if an error occurs */ + @Override @Before public void setUp() throws Exception { @@ -156,7 +159,7 @@ public class TestProviderBase extends ProviderSuper { when(dao.getFilteredPdpGroups(any())).thenReturn(Collections.emptyList()); SessionData session = new SessionData(dao); - ToscaPolicyIdentifierOptVersion ident = new ToscaPolicyIdentifierOptVersion(POLICY1_NAME, POLICY1_VERSION); + ToscaConceptIdentifierOptVersion ident = new ToscaConceptIdentifierOptVersion(POLICY1_NAME, POLICY1_VERSION); assertThatThrownBy(() -> prov.processPolicy(session, ident)).isInstanceOf(PfModelException.class) .hasMessage("policy not supported by any PDP group: policyA 1.2.3"); @@ -167,7 +170,7 @@ public class TestProviderBase extends ProviderSuper { PfModelException exc = new PfModelException(Status.CONFLICT, EXPECTED_EXCEPTION); when(dao.getFilteredPolicyList(any())).thenThrow(exc); - ToscaPolicyIdentifierOptVersion req = loadRequest(); + ToscaConceptIdentifierOptVersion req = loadRequest(); assertThatThrownBy(() -> prov.process(req, this::handle)).isInstanceOf(PfModelRuntimeException.class) .hasCause(exc); } @@ -176,7 +179,7 @@ public class TestProviderBase extends ProviderSuper { public void testGetPolicy_NotFound() throws Exception { when(dao.getFilteredPolicyList(any())).thenReturn(Collections.emptyList()); - ToscaPolicyIdentifierOptVersion req = loadRequest(); + ToscaConceptIdentifierOptVersion req = loadRequest(); assertThatThrownBy(() -> prov.process(req, this::handle)).isInstanceOf(PfModelRuntimeException.class) .hasMessage("cannot find policy: policyA 1.2.3") .extracting(ex -> ((PfModelRuntimeException) ex).getErrorResponse().getResponseCode()) @@ -263,7 +266,7 @@ public class TestProviderBase extends ProviderSuper { PdpDeployPolicies request = loadFile("updateGroupReqMultiple.json", PdpDeployPolicies.class); prov.process(request, (data, deploy) -> { - for (ToscaPolicyIdentifierOptVersion policy : deploy.getPolicies()) { + for (ToscaConceptIdentifierOptVersion policy : deploy.getPolicies()) { handle(data, policy); } }); @@ -307,7 +310,7 @@ public class TestProviderBase extends ProviderSuper { * * @return a standard request */ - protected ToscaPolicyIdentifierOptVersion loadRequest() { + protected ToscaConceptIdentifierOptVersion loadRequest() { return loadRequest("requestBase.json"); } @@ -317,8 +320,8 @@ public class TestProviderBase extends ProviderSuper { * @param fileName name of the file from which to load * @return the request that was loaded */ - protected ToscaPolicyIdentifierOptVersion loadRequest(String fileName) { - return loadFile(fileName, ToscaPolicyIdentifierOptVersion.class); + protected ToscaConceptIdentifierOptVersion loadRequest(String fileName) { + return loadFile(fileName, PapPolicyIdentifier.class).getGenericIdentifier(); } /** @@ -326,7 +329,7 @@ public class TestProviderBase extends ProviderSuper { * * @return an empty request */ - protected ToscaPolicyIdentifierOptVersion loadEmptyRequest() { + protected ToscaConceptIdentifierOptVersion loadEmptyRequest() { return loadRequest("emptyRequestBase.json"); } @@ -337,7 +340,7 @@ public class TestProviderBase extends ProviderSuper { * @param request request to be handled * @throws PfModelException if an error occurred */ - private void handle(SessionData data, ToscaPolicyIdentifierOptVersion request) throws PfModelException { + private void handle(SessionData data, ToscaConceptIdentifierOptVersion request) throws PfModelException { prov.processPolicy(data, request); } @@ -369,7 +372,7 @@ public class TestProviderBase extends ProviderSuper { @Override protected Updater makeUpdater(SessionData data, ToscaPolicy policy, - ToscaPolicyIdentifierOptVersion desiredPolicy) { + ToscaConceptIdentifierOptVersion desiredPolicy) { return (group, subgroup) -> { if (shouldUpdate.remove()) { @@ -379,7 +382,7 @@ public class TestProviderBase extends ProviderSuper { data.trackDeploy(policy.getIdentifier(), Collections.singleton(PDP1)); data.trackUndeploy(policy.getIdentifier(), Collections.singleton(PDP2)); - ToscaPolicyIdentifier ident2 = new ToscaPolicyIdentifier(POLICY1_NAME, "9.9.9"); + ToscaConceptIdentifier ident2 = new ToscaConceptIdentifier(POLICY1_NAME, "9.9.9"); data.trackDeploy(ident2, Collections.singleton(PDP3)); data.trackUndeploy(ident2, Collections.singleton(PDP4)); return true; diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestSessionData.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestSessionData.java index 34b7c61f..a2914cfa 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestSessionData.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestSessionData.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +29,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -52,12 +53,11 @@ import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpUpdate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pap.main.notification.PolicyPdpNotificationData; public class TestSessionData extends ProviderSuper { @@ -73,9 +73,9 @@ public class TestSessionData extends ProviderSuper { private static final String EXPECTED_EXCEPTION = "expected exception"; private SessionData session; - private ToscaPolicyIdentifierOptVersion ident; - private ToscaPolicyTypeIdentifier type; - private ToscaPolicyTypeIdentifier type2; + private ToscaConceptIdentifierOptVersion ident; + private ToscaConceptIdentifier type; + private ToscaConceptIdentifier type2; private PdpGroup group1; private PdpGroup group2; @@ -84,13 +84,14 @@ public class TestSessionData extends ProviderSuper { * * @throws Exception if an error occurs */ + @Override @Before public void setUp() throws Exception { super.setUp(); - ident = new ToscaPolicyIdentifierOptVersion(POLICY_NAME, POLICY_VERSION); - type = new ToscaPolicyTypeIdentifier(POLICY_TYPE, POLICY_TYPE_VERSION); - type2 = new ToscaPolicyTypeIdentifier(POLICY_TYPE, POLICY_TYPE_VERSION + "0"); + ident = new ToscaConceptIdentifierOptVersion(POLICY_NAME, POLICY_VERSION); + type = new ToscaConceptIdentifier(POLICY_TYPE, POLICY_TYPE_VERSION); + type2 = new ToscaConceptIdentifier(POLICY_TYPE, POLICY_TYPE_VERSION + "0"); group1 = loadGroup("group1.json"); group2 = loadGroup("group2.json"); @@ -137,7 +138,7 @@ public class TestSessionData extends ProviderSuper { assertEquals(null, filter.getVersionPrefix()); // retrieve a second time using full version - should use cache - assertSame(policy1, session.getPolicy(new ToscaPolicyIdentifierOptVersion(policy1.getIdentifier()))); + assertSame(policy1, session.getPolicy(new ToscaConceptIdentifierOptVersion(policy1.getIdentifier()))); verify(dao).getFilteredPolicyList(any()); } @@ -155,7 +156,7 @@ public class TestSessionData extends ProviderSuper { assertEquals("1.", filter.getVersionPrefix()); // retrieve a second time using full version - should use cache - assertSame(policy1, session.getPolicy(new ToscaPolicyIdentifierOptVersion(policy1.getIdentifier()))); + assertSame(policy1, session.getPolicy(new ToscaConceptIdentifierOptVersion(policy1.getIdentifier()))); verify(dao).getFilteredPolicyList(any()); } @@ -173,7 +174,7 @@ public class TestSessionData extends ProviderSuper { assertEquals(null, filter.getVersionPrefix()); // retrieve a second time using full version - should use cache - assertSame(policy1, session.getPolicy(new ToscaPolicyIdentifierOptVersion(policy1.getIdentifier()))); + assertSame(policy1, session.getPolicy(new ToscaConceptIdentifierOptVersion(policy1.getIdentifier()))); verify(dao).getFilteredPolicyList(any()); } @@ -577,7 +578,7 @@ public class TestSessionData extends ProviderSuper { when(dao.getFilteredPolicyList(any())).thenReturn(Arrays.asList(policy)); - ToscaPolicyIdentifier policyId = new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION); + ToscaConceptIdentifier policyId = new ToscaConceptIdentifier(POLICY_NAME, POLICY_VERSION); List<String> pdps = Arrays.asList(PDP1, PDP2); for (TrackEx trackFunc : trackFuncs) { @@ -657,6 +658,6 @@ public class TestSessionData extends ProviderSuper { @FunctionalInterface private static interface TrackEx { - public void accept(ToscaPolicyIdentifier policyId, Collection<String> pdps) throws PfModelException; + public void accept(ToscaConceptIdentifier policyId, Collection<String> pdps) throws PfModelException; } } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeleteTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeleteTest.java index d9fc66ad..55cf2f4c 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeleteTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeleteTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +41,7 @@ import org.onap.policy.models.pap.concepts.PdpGroupDeleteResponse; import org.onap.policy.models.pap.concepts.PolicyNotification; import org.onap.policy.models.pap.concepts.PolicyStatus; import org.onap.policy.models.pdp.concepts.PdpStatus; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.pap.main.PapConstants; public class PdpGroupDeleteTest extends End2EndBase { @@ -63,6 +64,7 @@ public class PdpGroupDeleteTest extends End2EndBase { /** * Sets up. */ + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -152,7 +154,7 @@ public class PdpGroupDeleteTest extends End2EndBase { assertEquals(2, deleted.getSuccessCount()); assertEquals(0, deleted.getFailureCount()); assertEquals(0, deleted.getIncompleteCount()); - assertEquals(new ToscaPolicyIdentifier("onap.restart.tcaB", "1.0.0"), deleted.getPolicy()); + assertEquals(new ToscaConceptIdentifier("onap.restart.tcaB", "1.0.0"), deleted.getPolicy()); rawresp = invocationBuilder.delete(); resp = rawresp.readEntity(PdpGroupDeleteResponse.class); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeployTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeployTest.java index 549ae206..3c5bed87 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeployTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupDeployTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +48,7 @@ import org.onap.policy.models.pdp.concepts.DeploymentGroup; import org.onap.policy.models.pdp.concepts.DeploymentGroups; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.pap.main.PapConstants; public class PdpGroupDeployTest extends End2EndBase { @@ -71,6 +72,7 @@ public class PdpGroupDeployTest extends End2EndBase { /** * Sets up. */ + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -90,7 +92,7 @@ public class PdpGroupDeployTest extends End2EndBase { status11.setPdpType(DEPLOY_SUBGROUP); status11.setPdpSubgroup(DEPLOY_SUBGROUP); - List<ToscaPolicyIdentifier> idents = Arrays.asList(new ToscaPolicyIdentifier("onap.restart.tca", "1.0.0")); + List<ToscaConceptIdentifier> idents = Arrays.asList(new ToscaConceptIdentifier("onap.restart.tca", "1.0.0")); status11.setPolicies(idents); PdpStatus status12 = new PdpStatus(); @@ -147,9 +149,9 @@ public class PdpGroupDeployTest extends End2EndBase { status11.setPdpType(DEPLOY_SUBGROUP); status11.setPdpSubgroup(DEPLOY_SUBGROUP); - final ToscaPolicyIdentifier ident = new ToscaPolicyIdentifier("onap.restart.tcaB", "1.0.0"); + final ToscaConceptIdentifier ident = new ToscaConceptIdentifier("onap.restart.tcaB", "1.0.0"); - List<ToscaPolicyIdentifier> idents = Arrays.asList(ident); + List<ToscaConceptIdentifier> idents = Arrays.asList(ident); status11.setPolicies(idents); PdpStatus status12 = new PdpStatus(); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupQueryTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupQueryTest.java index 5f16751c..a0a40ce5 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupQueryTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupQueryTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,8 +40,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroups; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.enums.PdpHealthStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class PdpGroupQueryTest extends End2EndBase { private static final String GROUP_ENDPOINT = "pdps"; @@ -94,17 +94,17 @@ public class PdpGroupQueryTest extends End2EndBase { assertEquals(2, filterList(subgrp.getPdpInstances(), pdp -> pdp.getHealthy() == PdpHealthStatus.HEALTHY) .size()); assertEquals("pdpTypeA", subgrp.getPdpType()); - assertEquals("[onap.restart.tca]", mapList(subgrp.getPolicies(), ToscaPolicyIdentifier::getName).toString()); - assertEquals("[1.0.0]", mapList(subgrp.getPolicies(), ToscaPolicyIdentifier::getVersion).toString()); + assertEquals("[onap.restart.tca]", mapList(subgrp.getPolicies(), ToscaConceptIdentifier::getName).toString()); + assertEquals("[1.0.0]", mapList(subgrp.getPolicies(), ToscaConceptIdentifier::getVersion).toString()); Map<String, Object> props = new LinkedHashMap<>(); props.put("ten", 10); assertEquals(props.toString(), subgrp.getProperties().toString()); assertEquals("[onap.policies.monitoring.cdap.tca.hi.lo.app]", - mapList(subgrp.getSupportedPolicyTypes(), ToscaPolicyTypeIdentifier::getName).toString()); + mapList(subgrp.getSupportedPolicyTypes(), ToscaConceptIdentifier::getName).toString()); assertEquals("[1.0.0]", - mapList(subgrp.getSupportedPolicyTypes(), ToscaPolicyTypeIdentifier::getVersion).toString()); + mapList(subgrp.getSupportedPolicyTypes(), ToscaConceptIdentifier::getVersion).toString()); } private void checkGroup2(PdpGroup group) { diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupStateChangeTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupStateChangeTest.java index 8cfc800c..df7fcc01 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupStateChangeTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupStateChangeTest.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +35,7 @@ import org.junit.Test; import org.onap.policy.models.pap.concepts.PdpGroupStateChangeResponse; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class PdpGroupStateChangeTest extends End2EndBase { private static final String PDP1 = "pdpAA_1"; @@ -61,6 +62,7 @@ public class PdpGroupStateChangeTest extends End2EndBase { /** * Sets up. */ + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -72,9 +74,9 @@ public class PdpGroupStateChangeTest extends End2EndBase { public void testMakePassive() throws Exception { addGroups("stateChangeGroupDeactivate.json"); - ToscaPolicyIdentifier policy = - new ToscaPolicyIdentifier("onap.restart.tca", "1.0.0"); - List<ToscaPolicyIdentifier> policies = Collections.singletonList(policy); + ToscaConceptIdentifier policy = + new ToscaConceptIdentifier("onap.restart.tca", "1.0.0"); + List<ToscaConceptIdentifier> policies = Collections.singletonList(policy); PdpStatus status11 = new PdpStatus(); status11.setName(PDP1); |