summaryrefslogtreecommitdiffstats
path: root/applications/common/src/test
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-10-04 16:47:28 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-10-04 16:48:21 +0100
commit5e6a65cff426adbbad5391a74b9c275b668058c3 (patch)
treea23e8de294e41f41aba49ec60ae9e71299dde603 /applications/common/src/test
parent56c7a53919852f69767f80ae5d671794a985a163 (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')
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java3
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPipTest.java28
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java1
-rw-r--r--applications/common/src/test/resources/META-INF/persistence.xml6
-rw-r--r--applications/common/src/test/resources/test.properties1
5 files changed, 19 insertions, 20 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());
diff --git a/applications/common/src/test/resources/META-INF/persistence.xml b/applications/common/src/test/resources/META-INF/persistence.xml
index 87896a60..53597b91 100644
--- a/applications/common/src/test/resources/META-INF/persistence.xml
+++ b/applications/common/src/test/resources/META-INF/persistence.xml
@@ -20,16 +20,18 @@
============LICENSE_END=========================================================
-->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
<persistence-unit name="PipEngineTest" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>org.onap.policy.guard.OperationsHistory</class>
<properties>
<property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="jakarta.persistence.schema-generation.create-source" value="metadata"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
- <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
diff --git a/applications/common/src/test/resources/test.properties b/applications/common/src/test/resources/test.properties
index 77939c35..58aa5b16 100644
--- a/applications/common/src/test/resources/test.properties
+++ b/applications/common/src/test/resources/test.properties
@@ -40,7 +40,6 @@ get-operation-outcome.persistenceunit=PipEngineTest
#
# JPA Properties
#
-eclipselink.target-database=Auto
jakarta.persistence.jdbc.driver=org.h2.Driver
jakarta.persistence.jdbc.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE
jakarta.persistence.jdbc.user=policy