diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2023-10-04 16:47:28 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2023-10-04 16:48:21 +0100 |
commit | 5e6a65cff426adbbad5391a74b9c275b668058c3 (patch) | |
tree | a23e8de294e41f41aba49ec60ae9e71299dde603 /applications/common/src/test/java | |
parent | 56c7a53919852f69767f80ae5d671794a985a163 (diff) |
Remove AAF from xacml-pdp
Issue-ID: POLICY-4592
Change-Id: I5b23b31df436c64f15d98a6f6731ec842d4df86d
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'applications/common/src/test/java')
3 files changed, 15 insertions, 17 deletions
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java index 0231c058..bd42933c 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021,2023 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,7 +102,6 @@ public class PolicyApiCallerTest { ApiRestController.class.getName()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX, "false"); - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_AAF_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, GsonMessageBodyHandler.class.getName()); diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java index e564cd96..c38ab716 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java @@ -26,13 +26,13 @@ import static org.mockito.Mockito.when; import com.att.research.xacml.api.Attribute; import com.att.research.xacml.api.AttributeValue; -import com.att.research.xacml.api.Status; import com.att.research.xacml.api.pip.PIPException; import com.att.research.xacml.api.pip.PIPFinder; import com.att.research.xacml.api.pip.PIPRequest; import com.att.research.xacml.api.pip.PIPResponse; import com.att.research.xacml.std.pip.StdPIPResponse; import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.Persistence; import jakarta.persistence.Query; import java.io.FileInputStream; @@ -44,6 +44,7 @@ import java.util.LinkedList; import java.util.Properties; import java.util.Queue; import java.util.UUID; +import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -64,6 +65,7 @@ public class CountRecentOperationsPipTest { private static final String TARGET = "my-target"; private static final String TEST_PROPERTIES = "src/test/resources/test.properties"; + private static EntityManagerFactory emf; private static EntityManager em; @Mock @@ -81,9 +83,6 @@ public class CountRecentOperationsPipTest { @Mock private PIPResponse resp3; - @Mock - private Status okStatus; - private Properties properties; private Queue<PIPResponse> responses; private Queue<String> attributes; @@ -110,11 +109,12 @@ public class CountRecentOperationsPipTest { // String persistenceUnit = CountRecentOperationsPip.ISSUER_NAME + ".persistenceunit"; LOGGER.info("persistenceunit {}", persistenceUnit); - em = Persistence.createEntityManagerFactory(props2.getProperty(persistenceUnit), props2).createEntityManager(); + emf = Persistence.createEntityManagerFactory(props2.getProperty(persistenceUnit), props2); + em = emf.createEntityManager(); // // // - LOGGER.info("Configured own entity manager", em.toString()); + LOGGER.info("Configured own entity manager {}", em.toString()); } /** @@ -153,7 +153,7 @@ public class CountRecentOperationsPipTest { } @Test - public void testConfigure_DbException() throws Exception { + public void testConfigure_DbException() { properties.put("jakarta.persistence.jdbc.url", "invalid"); assertThatCode(() -> pipEngine.configure("issuer", properties) @@ -208,7 +208,7 @@ public class CountRecentOperationsPipTest { // // create entry // - OperationsHistory newEntry = createEntry("cl-foobar-1", "vnf-1", "SUCCESS"); + OperationsHistory newEntry = createEntry(); // // No entries yet // @@ -231,9 +231,9 @@ public class CountRecentOperationsPipTest { } @Test - public void testStringToChronoUnit() throws PIPException { + public void testStringToChronosUnit() throws PIPException { // not configured yet - OperationsHistory newEntry = createEntry("cl-foobar-1", "vnf-1", "SUCCESS"); + OperationsHistory newEntry = createEntry(); assertEquals(-1, getCount(newEntry)); // now configure it @@ -271,14 +271,14 @@ public class CountRecentOperationsPipTest { return ((Number) value.getValue()).longValue(); } - private OperationsHistory createEntry(String cl, String target, String outcome) { + private OperationsHistory createEntry() { // // Create entry // OperationsHistory newEntry = new OperationsHistory(); - newEntry.setClosedLoopName(cl); - newEntry.setTarget(target); - newEntry.setOutcome(outcome); + newEntry.setClosedLoopName("cl-foobar-1"); + newEntry.setTarget("vnf-1"); + newEntry.setOutcome("SUCCESS"); newEntry.setActor("Controller"); newEntry.setOperation("operationA"); newEntry.setStarttime(Date.from(Instant.now().minusMillis(20000))); diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java index 2edaf0e5..95880efe 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java @@ -128,7 +128,6 @@ public class StdMatchableTranslatorTest { ApiRestController.class.getName()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX, "false"); - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_AAF_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, GsonMessageBodyHandler.class.getName()); |