summaryrefslogtreecommitdiffstats
path: root/applications/guard/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-06-02 12:00:37 +0000
committerGerrit Code Review <gerrit@onap.org>2020-06-02 12:00:37 +0000
commit893d64185a9432e2fd8808e58f8a76566fceaaf9 (patch)
tree385c04e893dd674621ce7436be522cac0b53ed19 /applications/guard/src/test
parent4dcc36142e51b389c5df97c227acc08608caa3b0 (diff)
parent3c703e2e48c0e74cb580b8afafb212fb9728aeeb (diff)
Merge "Use OperationsHistory from models"
Diffstat (limited to 'applications/guard/src/test')
-rw-r--r--applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java6
-rw-r--r--applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/SonCoordinationTest.java10
-rw-r--r--applications/guard/src/test/resources/META-INF/persistence.xml4
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" />