Upgrade Java 17 in xacml-pdp
[policy/xacml-pdp.git] / applications / guard / src / test / java / org / onap / policy / xacml / pdp / application / guard / SonCoordinationTest.java
index 4c5bced..4e7bb12 100644 (file)
@@ -2,7 +2,8 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 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.
@@ -25,6 +26,8 @@ package org.onap.policy.xacml.pdp.application.guard;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import com.att.research.xacml.api.Response;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.Persistence;
 import java.io.File;
 import java.io.IOException;
 import java.time.Instant;
@@ -34,10 +37,6 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.ServiceLoader;
 import java.util.UUID;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Persistence;
-
 import org.apache.commons.lang3.tuple.Pair;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -47,17 +46,16 @@ import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 import org.junit.runners.MethodSorters;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.guard.OperationsHistory;
 import org.onap.policy.models.decisions.concepts.DecisionRequest;
 import org.onap.policy.models.decisions.concepts.DecisionResponse;
 import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
 import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider;
 import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
 import org.onap.policy.pdp.xacml.application.common.operationshistory.CountRecentOperationsPip;
-import org.onap.policy.pdp.xacml.application.common.operationshistory.Dbao;
 import org.onap.policy.pdp.xacml.xacmltest.TestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -68,7 +66,6 @@ public class SonCoordinationTest {
     private static final Logger LOGGER = LoggerFactory.getLogger(SonCoordinationTest.class);
     private static Properties properties = new Properties();
     private static File propertiesFile;
-    private static RestServerParameters clientParams = new RestServerParameters();
     private static XacmlApplicationServiceProvider service;
     private static DecisionRequest requestVpciNode1;
     private static DecisionRequest requestVsonhNode1;
@@ -128,7 +125,7 @@ public class SonCoordinationTest {
         // Tell it to initialize based on the properties file
         // we just built for it.
         //
-        service.initialize(propertiesFile.toPath().getParent(), clientParams);
+        service.initialize(propertiesFile.toPath().getParent(), null);
         //
         // Load Decision Requests
         //
@@ -154,7 +151,7 @@ public class SonCoordinationTest {
     @Before
     public void startClean() throws Exception {
         em.getTransaction().begin();
-        em.createQuery("DELETE FROM Dbao").executeUpdate();
+        em.createQuery("DELETE FROM OperationsHistory").executeUpdate();
         em.getTransaction().commit();
     }
 
@@ -271,7 +268,7 @@ public class SonCoordinationTest {
         //
         // Add an entry
         //
-        Dbao newEntry = new Dbao();
+        OperationsHistory newEntry = new OperationsHistory();
         newEntry.setActor(properties.get("actor").toString());
         newEntry.setOperation(properties.get("operation").toString());
         newEntry.setClosedLoopName(properties.get("clname").toString());
@@ -288,7 +285,7 @@ public class SonCoordinationTest {
 
     private void updateOperationEvent(long id, String outcome) {
 
-        Dbao updateEntry = em.find(Dbao.class, id);
+        OperationsHistory updateEntry = em.find(OperationsHistory.class, id);
         updateEntry.setOutcome(outcome);
         updateEntry.setEndtime(Date.from(Instant.now()));
         em.getTransaction().begin();