summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java51
-rw-r--r--docs/platform/index.rst4
-rw-r--r--docs/platform/modAmsterTemplate.rst6
-rw-r--r--docs/platform/runningEclipse.rst3
-rw-r--r--docs/platform/tutorial_cl.rst15
5 files changed, 62 insertions, 17 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
index ca2b6797d..5208ad7a7 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
@@ -35,18 +35,25 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
import org.hibernate.SessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.onap.policy.common.ia.IntegrityAuditProperties;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.pap.xacml.rest.controller.ActionPolicyDictionaryController;
import org.onap.policy.pap.xacml.rest.controller.ClosedLoopDictionaryController;
@@ -73,8 +80,8 @@ import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder;
import com.mockrunner.mock.web.MockServletInputStream;
-
public class XACMLPAPTest {
+ private static final Log logger = LogFactory.getLog(XACMLPAPTest.class);
private static final String ENVIRONMENT_HEADER = "Environment";
private List<String> headers = new ArrayList<>();
@@ -86,6 +93,48 @@ public class XACMLPAPTest {
private SessionFactory sessionFactory;
private CommonClassDao commonClassDao;
+ private static final String DEFAULT_DB_DRIVER = "org.h2.Driver";
+ private static final String DEFAULT_DB_USER = "sa";
+ private static final String DEFAULT_DB_PWD = "";
+
+ @Before
+ public void setUpDB() throws Exception {
+ logger.info("setUpDB: Entering");
+
+ Properties properties = new Properties();
+ properties.put(IntegrityAuditProperties.DB_DRIVER, XACMLPAPTest.DEFAULT_DB_DRIVER);
+ properties.put(IntegrityAuditProperties.DB_URL, "jdbc:h2:file:./sql/xacmlTest");
+ properties.put(IntegrityAuditProperties.DB_USER, XACMLPAPTest.DEFAULT_DB_USER);
+ properties.put(IntegrityAuditProperties.DB_PWD, XACMLPAPTest.DEFAULT_DB_PWD);
+ properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA");
+ properties.put(IntegrityAuditProperties.NODE_TYPE, "pap");
+
+ //Clean the iaTest DB table for IntegrityAuditEntity entries
+ cleanDb("testPapPU", properties);
+
+ logger.info("setUpDB: Exiting");
+ }
+
+ public void cleanDb(String persistenceUnit, Properties properties){
+ logger.debug("cleanDb: enter");
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit, properties);
+
+ EntityManager em = emf.createEntityManager();
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+
+ et.begin();
+
+ // Clean up the DB
+ em.createQuery("Delete from IntegrityAuditEntity").executeUpdate();
+
+ // commit transaction
+ et.commit();
+ em.close();
+ logger.debug("cleanDb: exit");
+ }
+
@Before
public void setUp() throws ServletException {
httpServletRequest = Mockito.mock(HttpServletRequest.class);
diff --git a/docs/platform/index.rst b/docs/platform/index.rst
index 1bedf09b0..2b89ee752 100644
--- a/docs/platform/index.rst
+++ b/docs/platform/index.rst
@@ -10,7 +10,6 @@ Policy Engine Platform
offeredapis.rst
installation.rst
policygui.rst
- modAmsterTemplate.rst
Policy Software Architecture
----------------------------
@@ -39,8 +38,9 @@ Policy Platform Tutorials
deployPDPPAP.rst
guardpolicy.rst
guardpdp.rst
- runningEclipse.rst
clsimulation.rst
+ modAmsterTemplate.rst
+ runningEclipse.rst
tutorial_cl.rst
tutorial_vDNS.rst
tutorial_VOLTE.rst
diff --git a/docs/platform/modAmsterTemplate.rst b/docs/platform/modAmsterTemplate.rst
index 690dd5d70..c08dbb641 100644
--- a/docs/platform/modAmsterTemplate.rst
+++ b/docs/platform/modAmsterTemplate.rst
@@ -2,9 +2,9 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-****************************************
-Modifying the Amsterdam release template
-****************************************
+******************************
+Modifying the Release Template
+******************************
.. contents::
:depth: 3
diff --git a/docs/platform/runningEclipse.rst b/docs/platform/runningEclipse.rst
index 4d26fdac7..b2bcd88fa 100644
--- a/docs/platform/runningEclipse.rst
+++ b/docs/platform/runningEclipse.rst
@@ -44,7 +44,8 @@ An HTTP 200 message for the GET request will also appear in the console in Eclip
.. image:: RunEcl_pdpd_200.png
-.. seealso:: To create a controller and run a control loop please refer to Modifying the Amsterdam release template.
+
+.. seealso:: To create a controller and run a control loop, refer to `Modifying the Release Template <modAmsterTemplate.html>`_.
End of Document
diff --git a/docs/platform/tutorial_cl.rst b/docs/platform/tutorial_cl.rst
index f73bf8991..3395ea718 100644
--- a/docs/platform/tutorial_cl.rst
+++ b/docs/platform/tutorial_cl.rst
@@ -35,22 +35,17 @@ When the processing is done, you get the choice of immediately deploying the pol
Proceed with testing your new policy as described in the specific tutorials:
-• vCPE - Tutorial: Testing the vCPE use case in a standalone PDP-D
-• vDNS - Tutorial: Testing the vDNS Use Case in a standalone PDP-D
-• vFW - Tutorial: Testing the vFW flow in a standalone PDP-D
-• VoLTE - Tutorial: Testing the VOLTE Use Case in a standalone PDP-D
-
-If you would like to deploy a control loop in Eclipse from the control loop archetype template:
-
-• Modifying the Amsterdam release template
+• vCPE - `Tutorial: Testing the vCPE use case in a standalone PDP-D <tutorial_vCPE.html>`_
+• vDNS - `Tutorial: Testing the vDNS Use Case in a standalone PDP-D <tutorial_vDNS.html>`_
+• vFW - `Tutorial: Testing the vFW flow in a standalone PDP-D <tutorial_vFW.html>`_
+• VoLTE - `Tutorial: Testing the VOLTE Use Case in a standalone PDP-D <tutorial_VOLTE.html>`_
+.. seealso:: To deploy a control loop in Eclipse from the control loop archetype template, refer to `Modifying the Release Template <modAmsterTemplate.html>`_.
End of Document
-
-
.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Tutorial%3A+Generating+and+Testing+your+own+Control+Loop+Operational+Policy+in+a+standalone+PDP-D