diff options
author | Jim Hahn <jrh3@att.com> | 2020-05-29 11:43:49 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-06-01 10:06:25 -0400 |
commit | 3c703e2e48c0e74cb580b8afafb212fb9728aeeb (patch) | |
tree | 70b0aa73da0949457998b4101547026e39060740 /applications/guard/src | |
parent | 9213cdfc854115fb427ca22c1d04f2b3051f806f (diff) |
Use OperationsHistory from models
Deleted Dbao and replaced it with the shared class in policy-models.
Also had to update the queries and the persistence.xml accordingly.
Issue-ID: POLICY-2581
Change-Id: I59dfa2f37c272796ccebc0f578c9f4e8e1b9c8ab
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'applications/guard/src')
3 files changed, 9 insertions, 11 deletions
diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java index f5392cfa..e83f4d29 100644 --- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java +++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java @@ -52,6 +52,7 @@ 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.models.tosca.authorative.concepts.ToscaPolicy; @@ -60,7 +61,6 @@ 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; @@ -160,7 +160,7 @@ public class GuardPdpApplicationTest { @Before public void startClean() throws Exception { em.getTransaction().begin(); - em.createQuery("DELETE FROM Dbao").executeUpdate(); + em.createQuery("DELETE FROM OperationsHistory").executeUpdate(); em.getTransaction().commit(); } @@ -362,7 +362,7 @@ public class GuardPdpApplicationTest { // // 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()); diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/SonCoordinationTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/SonCoordinationTest.java index 4c5bced7..ba51f556 100644 --- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/SonCoordinationTest.java +++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/SonCoordinationTest.java @@ -34,10 +34,8 @@ 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; @@ -51,13 +49,13 @@ 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; @@ -154,7 +152,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 +269,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 +286,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(); diff --git a/applications/guard/src/test/resources/META-INF/persistence.xml b/applications/guard/src/test/resources/META-INF/persistence.xml index 41b25b42..ceb255f8 100644 --- a/applications/guard/src/test/resources/META-INF/persistence.xml +++ b/applications/guard/src/test/resources/META-INF/persistence.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP ================================================================================ - Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ <persistence-unit name="OperationsHistoryPUTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.policy.pdp.xacml.application.common.operationshistory.Dbao</class> + <class>org.onap.policy.guard.OperationsHistory</class> <properties> <property name="eclipselink.ddl-generation" value="create-tables" /> <property name="eclipselink.logging.level" value="FINE" /> |