summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/test/resources/META-INF/persistence.xml86
-rw-r--r--controlloop/common/database/pom.xml96
-rw-r--r--controlloop/common/database/src/main/java/org/onap/policy/database/ToscaDictionary.java140
-rw-r--r--controlloop/common/database/src/main/java/org/onap/policy/database/operationshistory/CountRecentOperationsPip.java200
-rw-r--r--controlloop/common/database/src/main/java/org/onap/policy/database/operationshistory/Dbao.java79
-rw-r--r--controlloop/common/database/src/main/java/org/onap/policy/database/operationshistory/GetOperationOutcomePip.java133
-rw-r--r--controlloop/common/database/src/main/java/org/onap/policy/database/std/StdOnapPip.java249
-rw-r--r--controlloop/common/database/src/test/java/org/onap/policy/database/operationshistory/CountRecentOperationsPipTest.java288
-rw-r--r--controlloop/common/database/src/test/java/org/onap/policy/database/operationshistory/GetOperationOutcomePipTest.java273
-rw-r--r--controlloop/common/database/src/test/java/org/onap/policy/database/std/DbaoTest.java70
-rw-r--r--controlloop/common/database/src/test/java/org/onap/policy/database/std/StdOnapPipTest.java268
-rw-r--r--controlloop/common/database/src/test/resources/META-INF/persistence.xml43
-rw-r--r--controlloop/common/database/src/test/resources/test.properties38
-rw-r--r--controlloop/common/eventmanager/pom.xml10
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java4
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java10
-rw-r--r--controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml4
-rw-r--r--controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml86
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java3
-rw-r--r--controlloop/common/guard/src/main/resources/META-INF/persistence.xml12
-rw-r--r--controlloop/common/guard/src/test/resources/META-INF/persistence.xml86
-rw-r--r--controlloop/common/pom.xml1
-rw-r--r--controlloop/m2/guard/pom.xml6
-rw-r--r--controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java8
24 files changed, 155 insertions, 2038 deletions
diff --git a/controlloop/common/controller-usecases/src/test/resources/META-INF/persistence.xml b/controlloop/common/controller-usecases/src/test/resources/META-INF/persistence.xml
index 8caed2e01..5589713be 100644
--- a/controlloop/common/controller-usecases/src/test/resources/META-INF/persistence.xml
+++ b/controlloop/common/controller-usecases/src/test/resources/META-INF/persistence.xml
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- drools-applications
- ================================================================================
- Copyright (C) 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============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">
-
- <!-- In-mem DB for junit -->
- <persistence-unit name="OperationsHistoryPUTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.database.operationshistory.Dbao</class>
-
- <properties>
- <property name="eclipselink.ddl-generation" value="create-tables" />
- <property name="eclipselink.logging.level" value="INFO" />
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
- <property name="javax.persistence.jdbc.user" value="policy" />
- <property name="javax.persistence.jdbc.password" value="P01icY" />
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
- <property name="javax.persistence.schema-generation.create-source" value="metadata" />
- </properties>
- </persistence-unit>
-
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ drools-applications
+ ================================================================================
+ Copyright (C) 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============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">
+
+ <!-- In-mem DB for junit -->
+ <persistence-unit name="OperationsHistoryPUTest" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+ <class>org.onap.policy.guard.OperationsHistory</class>
+
+ <properties>
+ <property name="eclipselink.ddl-generation" value="create-tables" />
+ <property name="eclipselink.logging.level" value="INFO" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
+ <property name="javax.persistence.jdbc.user" value="policy" />
+ <property name="javax.persistence.jdbc.password" value="P01icY" />
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
+ <property name="javax.persistence.schema-generation.create-source" value="metadata" />
+ </properties>
+ </persistence-unit>
+
+</persistence>
diff --git a/controlloop/common/database/pom.xml b/controlloop/common/database/pom.xml
deleted file mode 100644
index 8651dc781..000000000
--- a/controlloop/common/database/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- drools-applications
- ================================================================================
- Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2020 Bell Canada.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>drools-applications-common</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>database</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>com.att.research.xacml</groupId>
- <artifactId>xacml-pdp</artifactId>
- <version>2.0.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-pdp</groupId>
- <artifactId>policy-management</artifactId>
- <version>${version.policy.drools-pdp}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <consoleOutput>true</consoleOutput>
- <failsOnViolation>true</failsOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>${oparent.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/controlloop/common/database/src/main/java/org/onap/policy/database/ToscaDictionary.java b/controlloop/common/database/src/main/java/org/onap/policy/database/ToscaDictionary.java
deleted file mode 100644
index b04a5b4d2..000000000
--- a/controlloop/common/database/src/main/java/org/onap/policy/database/ToscaDictionary.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.database;
-
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.api.XACML3;
-import com.att.research.xacml.std.IdentifierImpl;
-
-public final class ToscaDictionary {
-
- /*
- * These are the ID's for various TOSCA Policy Types we are supporting in the Applications.
- */
- public static final String URN_ONAP = "urn:org:onap";
- public static final Identifier ID_URN_ONAP =
- new IdentifierImpl(URN_ONAP);
-
- public static final Identifier ID_RESOURCE_POLICY_ID =
- XACML3.ID_RESOURCE_RESOURCE_ID;
-
- public static final Identifier ID_RESOURCE_POLICY_TYPE =
- new IdentifierImpl(ID_URN_ONAP, "policy-type");
-
- public static final Identifier ID_RESOURCE_POLICY_TYPE_VERSION =
- new IdentifierImpl(ID_URN_ONAP, "policy-type-version");
-
- /*
- * These ID's are for identifying Subjects
- */
-
- public static final Identifier ID_SUBJECT_ONAP_NAME =
- XACML3.ID_SUBJECT_SUBJECT_ID;
-
- public static final Identifier ID_SUBJECT_ONAP_COMPONENT =
- new }
<?xml version="1.0" encoding="UTF-8"?>
<!--

============LICENSE_START======================================================
    org.onap.aai
===============================================================================
    Copyright © 2019 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.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
===========LICENSE_END=========================================================

-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.onap.aai.aai-common</groupId>
		<artifactId>aai-common</artifactId>
		<version>1.6.5-SNAPSHOT</version>
	</parent>
	<artifactId>aai-parent</artifactId>
	<name>aai-parent</name>
	<packaging>pom</packaging>

	<modules>

	</modules>

	<properties>
		<!--  update this just prior to release or figure out something with version.properties -->
		<aai.release.version>${project.version}</aai.release.version>
		<aai.common.logging.version>1.5.1</aai.common.logging.version>
		<aai.rest.client.version>1.5.1</aai.rest.client.version>
		<aai.schema.service.version>1.6.0</aai.schema.service.version>

		<aaf.version>2.1.15</aaf.version>
		<antlr.version>4.7.2</antlr.version>
		<activemq.version>5.15.11</activemq.version>
		<codehaus.jackson.version>1.9.13</codehaus.jackson.version>
		<commons.beanutils.version>1.9.4</commons.beanutils.version>
		<commons.cli.version>1.4</commons.cli.version>
		<commons.compress.version>1.19</commons.compress.version>
		<commons.configuration.version>1.10</commons.configuration.version>
		<commons.io.version>2.6</commons.io.version>
		<commons.lang.version>2.6</commons.lang.version>
		<commons.lang3.version>3.9</commons.lang3.version>
		<commons.net.version>3.6</commons.net.version>
		<commons.text.version>1.8</commons.text.version>
		<docker.fabric.version>0.31.0</docker.fabric.version>
		<dmaap.client.version>1.1.9</dmaap.client.version>
		<eclipse.persistence.version>2.6.2</eclipse.persistence.version>
		<eelf.core.version>1.0.1-oss</eelf.core.version>
		<freemarker.version>2.3.29</freemarker.version>
		<google.guava.version>19.0</google.guava.version>
		<gremlin.version>3.2.3</gremlin.version>
		<groovy.version>2.5.8</groovy.version>
		<gson.version>2.8.6</gson.version>
		<hamcrest.junit.version>2.0.0.0</hamcrest.junit.version>
		<hamcrest.core.version>2.2</hamcrest.core.version>
		<jackson.bom.version>2.10.1</jackson.bom.version>
		<janusgraph.version>0.2.3</janusgraph.version>
		<javatuples.version>1.2</javatuples.version>
		<jaxb.version>2.2.12</jaxb.version>
		<jaxrs.version>2.0.1</jaxrs.version>
		<jcommander.version>1.78</jcommander.version>
		<jersey.version>1.19.4</jersey.version>
		<jnr.ffi.version>2.1.11</jnr.ffi.version>
		<jolt.version>0.0.24</jolt.version>
		<jopt.simple.version>5.0.4</jopt.simple.version>
		<jsonassert.version>1.5.0</jsonassert.version> 
		<json.patch.version>1.9</json.patch.version>
		<json.path.version>2.4.0</json.path.version>
		<json.version>20190722</json.version>
		<junit.version>4.12</junit.version>
		<httpclient.version>4.5.10</httpclient.version>
		<io.swagger.version>1.5.24</io.swagger.version>
		<logback.version>1.2.3</logback.version>
		<log4j.version>1.2.17</log4j.version>
		<mockito.all.version>1.10.19</mockito.all.version>
		<mockito.core.version>2.15.0</mockito.core.version>
		<netty.handler.version>4.1.43.Final</netty.handler.version>
		<netty.version>4.0.56.Final</netty.version>
		<opencsv.version>3.1</opencsv.version>
		<powermock.version>1.6.6</powermock.version>
		<plexus.utils.version>3.1.1</plexus.utils.version>
		<reflections.version>0.9.10</reflections.version>
		<snakeyaml.version>1.25</snakeyaml.version>
		<spring.boot.version>1.5.22.RELEASE</spring.boot.version>
		<jacoco.version>0.8.5</jacoco.version>
		<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
		<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
		<sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
		<sonar.exclusions>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</sonar.exclusions>
		
		<sonar.scanner.version>3.7.0.1746</sonar.scanner.version>
		
		<spring.web.version>4.3.25.RELEASE</spring.web.version>
		<spring.jms.version>4.3.25.RELEASE</spring.jms.version>
		<spring.test.version>4.3.25.RELEASE</spring.test.version>
		<spring.security.rsa.version>1.0.8.RELEASE</spring.security.rsa.version>

	</properties>
	<dependencyManagement>
		<dependencies>

			<dependency>
				<groupId>org.onap.aai.aai-common</groupId>
				<artifactId>aai-schema-ingest</artifactId>
				<version>${aai.release.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai.aai-common</groupId>
				<artifactId>aai-core</artifactId>
				<version>${aai.release.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai.aai-common</groupId>
				<artifactId>aai-annotations</artifactId>
				<version>${aai.release.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai.aai-common</groupId>
				<artifactId>aai-rest</artifactId>
				<version>${aai.release.version}</version>
			</dependency>

			<dependency>
				<groupId>com.fasterxml.jackson</groupId>
				<artifactId>jackson-bom</artifactId>
				<version>${jackson.bom.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
			  <groupId>org.springframework.boot</groupId>
			  <artifactId>spring-boot-starter-web</artifactId>
			  <version>${spring.boot.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.springframework.boot</groupId>
			  <artifactId>spring-boot-starter-parent</artifactId>
			  <version>${spring.boot.version}</version>
			  <type>pom</type>
			  <scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>${spring.boot.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-test</artifactId>
				<scope>test</scope>
				<version>${spring.boot.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.springframework</groupId>
			  <artifactId>spring-test</artifactId>
			  <version>${spring.test.version}</version>
			</dependency>

			<dependency>
				<groupId>commons-configuration</groupId>
				<artifactId>commons-configuration</artifactId>
				<version>${commons.configuration.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-lang3</artifactId>
				<version>${commons.lang3.version}</version>
			</dependency>


			<dependency>
				<groupId>commons-lang</groupId>
				<artifactId>commons-lang</artifactId>
				<version>${commons.lang.version}</version>
			</dependency>

			<dependency>
				<groupId>com.att.eelf</groupId>
				<artifactId>eelf-core</artifactId>
				<version>${eelf.core.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-core</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-classic</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-access</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>org.hamcrest</groupId>
				<artifactId>java-hamcrest</artifactId>
				<version>${hamcrest.junit.version}</version>
			</dependency>

			<dependency>
				<groupId>org.hamcrest</groupId>
				<artifactId>hamcrest-core</artifactId>
				<version>${hamcrest.core.version}</version>
			</dependency>

			<dependency>
				<groupId>org.hamcrest</groupId>
				<artifactId>hamcrest-junit</artifactId>
				<version>${hamcrest.junit.version}</version>
			</dependency>

			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit.version}</version>
			</dependency>

			<dependency>
				<groupId>com.google.guava</groupId>
				<artifactId>guava</artifactId>
				<version>${google.guava.version}</version>
			</dependency>

			<dependency>
				<groupId>org.janusgraph</groupId>
				<artifactId>janusgraph-core</artifactId>
				<version>${janusgraph.version}</version>
			</dependency>

			<dependency>
				<groupId>org.janusgraph</groupId>
				<artifactId>janusgraph-cassandra</artifactId>
				<version>${janusgraph.version}</version>
			</dependency>

			<dependency>
				<groupId>org.janusgraph</groupId>
				<artifactId>janusgraph-cql</artifactId>
				<version>${janusgraph.version}</version>
			</dependency>

			<dependency>
				<groupId>com.github.jnr</groupId>
				<artifactId>jnr-ffi</artifactId>
				<version>${jnr.ffi.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.tinkerpop</groupId>
				<artifactId>tinkergraph-gremlin</artifactId>
				<version>${gremlin.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.tinkerpop</groupId>
				<artifactId>gremlin-core</artifactId>
				<version>${gremlin.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.tinkerpop</groupId>
				<artifactId>gremlin-driver</artifactId>
				<version>${gremlin.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.tinkerpop</groupId>
				<artifactId>gremlin-groovy</artifactId>
				<version>${gremlin.version}</version>
			</dependency>

			<dependency>
				<groupId>org.codehaus.groovy</groupId>
				<artifactId>groovy</artifactId>
				<version>${groovy.version}</version>
				<classifier>indy</classifier>
			</dependency>

			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-all</artifactId>
				<version>${mockito.all.version}</version>
			</dependency>

			<!-- <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> 
				<version>${mockito.core.version}</version> </dependency> -->
			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-junit4</artifactId>
				<version>${powermock.version}</version>
			</dependency>

			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-junit4-rule-agent</artifactId>
				<version>${powermock.version}</version>
			</dependency>

			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-api-mockito</artifactId>
				<version>${powermock.version}</version>
			</dependency>
			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-javaagent</artifactId>
				<version>${powermock.version}</version>
			</dependency>
			<dependency>
				<groupId>com.beust</groupId>
				<artifactId>jcommander</artifactId>
				<version>${jcommander.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.antlr</groupId>
			  <artifactId>antlr4-runtime</artifactId>
			  <version>${antlr.version}</version>
			</dependency>
			<dependency>
			  <groupId>org.antlr</groupId>
			  <artifactId>antlr4-maven-plugin</artifactId>
			  <version>${antlr.version}</version>
			</dependency>
			
			<dependency>
			  <groupId>org.json</groupId>
			  <artifactId>json</artifactId>
			  <version>${json.version}</version>
			</dependency>

			<dependency>
				<groupId>org.freemarker</groupId>
				<artifactId>freemarker</artifactId>
				<version>${freemarker.version}</version>
			</dependency>

			<dependency>
				<groupId>javax.xml.bind</groupId>
				<artifactId>jaxb-api</artifactId>
				<version>${jaxb.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.activemq</groupId>
				<artifactId>activemq-broker</artifactId>
				<version>${activemq.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.activemq</groupId>
				<artifactId>activemq-client</artifactId>
				<version>${activemq.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.activemq</groupId>
				<artifactId>activemq-openwire-legacy</artifactId>
				<version>${activemq.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aaf.authz</groupId>
				<artifactId>aaf-cadi-aaf</artifactId>
				<version>${aaf.version}</version>
			</dependency>

			<dependency>
				<groupId>com.sun.xml.bind</groupId>
				<artifactId>jaxb-xjc</artifactId>
				<version>${jaxb.version}</version>
			</dependency>

			<dependency>
				<groupId>org.eclipse.persistence</groupId>
				<artifactId>eclipselink</artifactId>
				<version>${eclipse.persistence.version}</version>
			</dependency>

			<dependency>
				<groupId>org.eclipse.persistence</groupId>
				<artifactId>org.eclipse.persistence.moxy</artifactId>
				<version>${eclipse.persistence.version}</version>
			</dependency>

			<dependency>
				<groupId>com.github.fge</groupId>
				<artifactId>json-patch</artifactId>
				<version>${json.patch.version}</version>
			</dependency>

			<dependency>
			  <groupId>com.jayway.jsonpath</groupId>
			  <artifactId>json-path</artifactId>
			  <version>${json.path.version}</version>
			</dependency>

			<dependency>
				<groupId>org.javatuples</groupId>
				<artifactId>javatuples</artifactId>
				<version>${javatuples.version}</version>
			</dependency>

			<dependency>
				<groupId>com.google.code.gson</groupId>
				<artifactId>gson</artifactId>
				<version>${gson.version}</version>
			</dependency>

			
			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-text</artifactId>
				<version>${commons.text.version}</version>
			</dependency>

			<dependency>
				<groupId>org.codehaus.jackson</groupId>
				<artifactId>jackson-core-asl</artifactId>
				<version>${codehaus.jackson.version}</version>
			</dependency>

			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-core</artifactId>
				<version>${jersey.version}</version>
			</dependency>
			
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-client</artifactId>
				<version>${jersey.version}</version>
			</dependency>
			
			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-json</artifactId>
				<version>${jersey.version}</version>
			</dependency>

			<dependency>
				<groupId>javax.ws.rs</groupId>
				<artifactId>javax.ws.rs-api</artifactId>
				<version>${jaxrs.version}</version>
			</dependency>

			<dependency>
				<groupId>commons-cli</groupId>
				<artifactId>commons-cli</artifactId>
				<version>${commons.cli.version}</version>
			</dependency>

			<dependency>
				<groupId>com.bazaarvoice.jolt</groupId>
				<artifactId>jolt-complete</artifactId>
				<version>${jolt.version}</version>
			</dependency>

			<dependency>
				<groupId>com.opencsv</groupId>
				<artifactId>opencsv</artifactId>
				<version>${opencsv.version}</version>
			</dependency>

			<dependency>
				<groupId>log4j</groupId>
				<artifactId>log4j</artifactId>
				<version>${log4j.version}</version>
			</dependency>
			
			<dependency>
				<groupId>log4j</groupId>
				<artifactId>apache-log4j-extras</artifactId>
				<version>${log4j.version}</version>
			</dependency>

			<dependency>
				<groupId>commons-io</groupId>
				<artifactId>commons-io</artifactId>
				<version>${commons.io.version}</version>
			</dependency>


			<dependency>
				<groupId>org.springframework.security</groupId>
				<artifactId>spring-security-rsa</artifactId>
				<version>${spring.security.rsa.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.springframework</groupId>
			  <artifactId>spring-jms</artifactId>
			  <version>${spring.jms.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai.logging-service</groupId>
				<artifactId>common-logging</artifactId>
				<version>${aai.common.logging.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai.logging-service</groupId>
				<artifactId>logging-api</artifactId>
				<version>${aai.common.logging.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.aai</groupId>
				<artifactId>rest-client</artifactId>
				<version>${aai.rest.client.version}</version>
			</dependency>

			<dependency>
				<groupId>net.sf.jopt-simple</groupId>
				<artifactId>jopt-simple</artifactId>
				<version>${jopt.simple.version}</version>
			</dependency>

			<dependency>
				<groupId>io.swagger</groupId>
				<artifactId>swagger-core</artifactId>
				<version>${io.swagger.version}</version>
			</dependency>

			<dependency>
				<groupId>io.swagger</groupId>
				<artifactId>swagger-annotations</artifactId>
				<version>${io.swagger.version}</version>
			</dependency>

			<dependency>
				<groupId>io.swagger</groupId>
				<artifactId>swagger-jersey-jaxrs</artifactId>
				<version>${io.swagger.version}</version>
			</dependency>

			<dependency>
				<groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
				<artifactId>dmaapClient</artifactId>
				<version>${dmaap.client.version}</version>
			</dependency>

			<dependency>
				<groupId>io.netty</groupId>
				<artifactId>netty-handler</artifactId>
				<version>${netty.handler.version}</version>
			</dependency>

			<dependency>
				<groupId>io.netty</groupId>
				<artifactId>netty-all</artifactId>
				<version>${netty.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.onap.aai.schema-service</groupId>
                          <artifactId>aai-schema</artifactId>
			  <version>${aai.schema.service.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.apache.httpcomponents</groupId>
			  <artifactId>httpclient</artifactId>
			  <version>${httpclient.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.skyscreamer</groupId>
			  <artifactId>jsonassert</artifactId>
			  <version>${jsonassert.version}</version>
			  <scope>test</scope>
			</dependency>

			<dependency>
			  <groupId>org.codehaus.plexus</groupId>
			  <artifactId>plexus-utils</artifactId>
			  <version>${plexus.utils.version}</version>
			</dependency>

			<dependency>
			  <groupId>org.yaml</groupId>
			  <artifactId>snakeyaml</artifactId>
			  <version>${snakeyaml.version}</version>
			</dependency>

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-compress</artifactId>
			<version>${commons.compress.version}</version>
		</dependency>

		<dependency>
			<groupId>org.reflections</groupId>
			<artifactId>reflections</artifactId>
			<version>${reflections.version}</version>
		</dependency>

		<dependency>
			<groupId>commons-net</groupId>
			<artifactId>commons-net</artifactId>
			<version>${commons.net.version}</version>
		</dependency>

		</dependencies>

	</dependencyManagement>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-maven-plugin</artifactId>
					<version>${spring.boot.version}</version>
				</plugin>
				<plugin>
					<groupId>io.fabric8</groupId>
					<artifactId>docker-maven-plugin</artifactId>
					<version>${docker.fabric.version}</version>
				</plugin>
				
				<plugin>
				  <groupId>org.sonarsource.scanner.maven</groupId>
				  <artifactId>sonar-maven-plugin</artifactId>
				  <version>${sonar.scanner.version}</version>
				</plugin>

				<plugin>
				  <groupId>org.jacoco</groupId>
				  <artifactId>jacoco-maven-plugin</artifactId>
				  <version>${jacoco.version}</version>
				  <configuration>
				    <!-- Note: This exclusion list should match <sonar.exclusions>
					 property above -->
				    <excludes>
				      <exclude>**/gen/**</exclude>
				      <exclude>**/generated-sources/**</exclude>
				      <exclude>**/yang-gen/**</exclude>
				      <exclude>**/pax/**</exclude>
				    </excludes>
				  </configuration>
				  <executions>
				    <!--
					Prepares the property pointing to the JaCoCo runtime agent which
					is passed as VM argument when Maven the Surefire plugin is executed.
				    -->
				    <execution>
				      <id>pre-unit-test</id>
				      <goals>
					<goal>prepare-agent</goal>
				      </goals>
				      <configuration>
					<!-- Sets the path to the file which contains the execution data
					     . -->
					<destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</destFile>
					<!--
					    Sets the name of the property containing the settings
					    for JaCoCo runtime agent.
					-->
					<propertyName>surefireArgLine</propertyName>
				      </configuration>
				    </execution>
				    <!--
					Ensures that the code coverage report for unit tests is created after
					unit tests have been run.
				    -->
				    <execution>
				      <id>post-unit-test</id>
				      <phase>test</phase>
				      <goals>
					<goal>report</goal>
				      </goals>
				      <configuration>
					<!-- Sets the path to the file which contains the execution data
					     . -->
					<dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
					<!-- Sets the output directory for the code coverage report. -->
					<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
				      </configuration>
				    </execution>
				    <execution>
				      <id>pre-integration-test</id>
				      <phase>pre-integration-test</phase>
				      <goals>
					<goal>prepare-agent</goal>
				      </goals>
				      <configuration>
					<!-- Sets the path to the file which contains the execution data
					     . -->
					<destFile>${project.build.directory}/code-coverage/jacoco-it.exec</destFile>
					<!--
					    Sets the name of the property containing the settings
					    for JaCoCo runtime agent.
					-->
					<propertyName>failsafeArgLine</propertyName>
				      </configuration>
				    </execution>
				    <!--
					Ensures that the code coverage report for integration tests after
					integration tests have been run.
				    -->
				    <execution>
				      <id>post-integration-test</id>
				      <phase>post-integration-test</phase>
				      <goals>
					<goal>report</goal>
				      </goals>
				      <configuration>
					<!-- Sets the path to the file which contains the execution data
					     . -->
					<dataFile>${project.build.directory}/code-coverage/jacoco-it.exec</dataFile>
					<!-- Sets the output directory for the code coverage report. -->
					<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
				      </configuration>
				    </execution>
			    </executions>
			  </plugin>
			</plugins>
		</pluginManagement>
	</build>

</project>
XCEPTION = "expected exception";
- private static final String ISSUER_PREFIX = ToscaDictionary.GUARD_ISSUER_PREFIX + "-my-issuer:clname:";
- private static final String ISSUER = ISSUER_PREFIX + TEST_CL1;
- private static final Logger LOGGER = LoggerFactory.getLogger(GetOperationOutcomePipTest.class);
-
- private static MyPip pipEngine;
- private static Properties properties;
-
- private static EntityManagerFactory emf;
- private static EntityManager em;
-
- private PIPRequest req;
-
- /**
- * Create an instance of our engine and also the persistence
- * factory.
- *
- * @throws Exception connectivity issues
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- LOGGER.info("Setting up PIP Testing");
- //
- // Create instance
- //
- pipEngine = new MyPip(TEST_TARGET1);
- //
- // Load our test properties to use
- //
- properties = new Properties();
- try (FileInputStream is = new FileInputStream("src/test/resources/test.properties")) {
- properties.load(is);
- }
- //
- // Configure it using properties
- //
- pipEngine.configure(ID, properties);
- LOGGER.info("PIP configured now creating our entity manager");
- LOGGER.info("properties {}", properties);
- //
- // Connect to in-mem db
- //
- String persistenceUnit = GetOperationOutcomePip.ISSUER_NAME + ".persistenceunit";
- LOGGER.info("persistenceunit {}", persistenceUnit);
- emf = Persistence.createEntityManagerFactory(properties.getProperty(persistenceUnit), properties);
- em = emf.createEntityManager();
- //
- //
- //
- LOGGER.info("Configured own entity manager", em.toString());
- }
-
- @Before
- public void setUp() {
- req = mock(PIPRequest.class);
- when(req.getIssuer()).thenReturn(ISSUER);
- }
-
- private void insertEntry(String cl, String target, String outcome) {
- //
- // Create entry
- //
- Dbao newEntry = new Dbao();
- newEntry.setClosedLoopName(cl);
- newEntry.setTarget(target);
- newEntry.setOutcome(outcome);
- newEntry.setActor(ACTOR);
- newEntry.setOperation(RECIPE);
- newEntry.setStarttime(Date.from(Instant.now().minusMillis(20000)));
- newEntry.setEndtime(Date.from(Instant.now()));
- newEntry.setRequestId(UUID.randomUUID().toString());
- //
- // Add entry
- //
- em.getTransaction().begin();
- em.persist(newEntry);
- em.getTransaction().commit();
- }
-
-
- @Test
- public void testAttributesRequired() {
- assertEquals(1, pipEngine.attributesRequired().size());
- }
-
- @Test
- public void testGetAttributes_InvalidRequestInfo() throws PIPException {
- // invalid request - null issuer
- when(req.getIssuer()).thenReturn(null);
- assertEquals(StdPIPResponse.PIP_RESPONSE_EMPTY, pipEngine.getAttributes(req, null));
-
- /*
- * Make a valid issuer in the request, for subsequent tests.
- */
- when(req.getIssuer()).thenReturn(ISSUER);
-
- // null target
- MyPip pip = new MyPip(null);
- pip.configure(ID, properties);
- assertEquals(StdPIPResponse.PIP_RESPONSE_EMPTY, pip.getAttributes(req, null));
- }
-
- @Test
- public void testDoDatabaseQuery() throws Exception {
- //
- // Insert entry
- //
- insertEntry(TEST_CL1, TEST_TARGET1, "1");
- //
- // outcome should be "1"
- //
- assertEquals("1", getOutcome(pipEngine.getAttributes(req, null)));
- //
- // Insert more entries
- //
- insertEntry(TEST_CL1, TEST_TARGET1, "2");
- insertEntry("testcl2", TEST_TARGET2, "3");
- insertEntry(TEST_CL1, TEST_TARGET2, "4");
- //
- // Test pipEngine
- //
- assertEquals("2", getOutcome(TEST_CL1, TEST_TARGET1));
-
- assertEquals("3", getOutcome("testcl2", TEST_TARGET2));
-
- assertEquals("4", getOutcome(TEST_CL1, TEST_TARGET2));
- }
-
- @Test
- public void testDoDatabaseQuery_NoResult() throws Exception {
- MyPip pip = new MyPip(TEST_TARGET1) {
- @Override
- public void configure(String id, Properties properties) throws PIPException {
- em = mock(EntityManager.class);
- when(em.createQuery(anyString())).thenThrow(new NoResultException());
- }
- };
- pip.configure(ID, properties);
-
- assertNull(getOutcome(pip.getAttributes(req, null)));
- }
-
- @Test
- public void testDoDatabaseQuery_EmException() throws Exception {
- MyPip pip = new MyPip(TEST_TARGET1) {
- @Override
- public void configure(String id, Properties properties) throws PIPException {
- em = mock(EntityManager.class);
- when(em.createQuery(anyString())).thenThrow(new RuntimeException(EXPECTED_EXCEPTION));
- }
- };
- pip.configure(ID, properties);
-
- assertEquals(null, getOutcome(pip.getAttributes(req, null)));
- }
-
- private String getOutcome(String clname, String target) throws PIPException {
- req = mock(PIPRequest.class);
- when(req.getIssuer()).thenReturn(ISSUER_PREFIX + clname);
-
- MyPip pip = new MyPip(target);
- pip.configure(ID, properties);
-
- return getOutcome(pip.getAttributes(req, null));
- }
-
- private String getOutcome(PIPResponse resp) {
- Collection<Attribute> attrs = resp.getAttributes();
- assertEquals(1, attrs.size());
-
- Attribute attr = attrs.iterator().next();
- assertEquals(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, attr.getCategory());
- assertEquals(ToscaDictionary.ID_RESOURCE_GUARD_OPERATIONOUTCOME, attr.getAttributeId());
-
- Collection<AttributeValue<?>> values = attr.getValues();
- assertEquals(1, values.size());
-
- AttributeValue<?> value = values.iterator().next();
- return (String) value.getValue();
- }
-
- /**
- * Close the entity manager.
- */
- @AfterClass
- public static void cleanup() {
- if (emf != null) {
- emf.close();
- }
- }
-
- private static class MyPip extends GetOperationOutcomePip {
- private String target;
-
- public MyPip(String target) {
- this.target = target;
- }
-
- @Override
- protected String getActor(PIPFinder pipFinder) {
- return ACTOR;
- }
-
- @Override
- protected String getRecipe(PIPFinder pipFinder) {
- return RECIPE;
- }
-
- @Override
- protected String getTarget(PIPFinder pipFinder) {
- return target;
- }
- }
-}
diff --git a/controlloop/common/database/src/test/java/org/onap/policy/database/std/DbaoTest.java b/controlloop/common/database/src/test/java/org/onap/policy/database/std/DbaoTest.java
deleted file mode 100644
index 43c6157cf..000000000
--- a/controlloop/common/database/src/test/java/org/onap/policy/database/std/DbaoTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.database.std;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import org.junit.Test;
-import org.onap.policy.database.operationshistory.Dbao;
-
-public class DbaoTest {
-
- @Test
- public void test() {
- Dbao dao = new Dbao();
-
- dao.setActor("my-actor");
- dao.setClosedLoopName("cl-name");
- Date endDate = new Date();
- dao.setEndtime(endDate);
- dao.setId(100L);
- dao.setMessage("my-message");
- dao.setOperation("my-operation");
- dao.setOutcome("my-outcome");
- dao.setRequestId("my-request");
- Date startDate = new Date(endDate.getTime() - 1);
- dao.setStarttime(startDate);
- dao.setSubrequestId("my-sub");
- dao.setTarget("my-target");
-
- assertEquals("my-actor", dao.getActor());
- assertEquals("cl-name", dao.getClosedLoopName());
- assertEquals(endDate, dao.getEndtime());
- assertEquals(100L, dao.getId().longValue());
- assertEquals("my-message", dao.getMessage());
- assertEquals("my-operation", dao.getOperation());
- assertEquals("my-outcome", dao.getOutcome());
- assertEquals("my-request", dao.getRequestId());
- assertEquals(startDate, dao.getStarttime());
- assertEquals("my-sub", dao.getSubrequestId());
- assertEquals("my-target", dao.getTarget());
-
- assertTrue(dao.toString().startsWith("Dbao"));
-
- int hc = dao.hashCode();
- dao.setId(101L);
- assertTrue(hc != dao.hashCode());
-
- assertTrue(dao.equals(dao));
- assertFalse(dao.equals(new Dbao()));
- }
-}
diff --git a/controlloop/common/database/src/test/java/org/onap/policy/database/std/StdOnapPipTest.java b/controlloop/common/database/src/test/java/org/onap/policy/database/std/StdOnapPipTest.java
deleted file mode 100644
index de186c41d..000000000
--- a/controlloop/common/database/src/test/java/org/onap/policy/database/std/StdOnapPipTest.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.database.std;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-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.Identifier;
-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.datatypes.DataTypes;
-import com.att.research.xacml.std.pip.StdMutablePIPResponse;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.database.ToscaDictionary;
-
-public class StdOnapPipTest {
- private static final String EXPECTED_EXCEPTION = "expected exception";
- private static final String A_VALUE = "a-value";
- private static final String ISSUER = ToscaDictionary.GUARD_ISSUER_PREFIX + "-my-issuer";
-
- private MyPip pip;
- private PIPRequest req;
- private PIPFinder finder;
- private StdMutablePIPResponse resp;
-
- /**
- * Initializes mocks and populates {@link #pip}.
- */
- @Before
- public void setUp() {
- req = mock(PIPRequest.class);
- finder = mock(PIPFinder.class);
- resp = new StdMutablePIPResponse();
-
- when(req.getIssuer()).thenReturn(ISSUER);
-
- pip = new MyPip();
- }
-
- @Test
- public void testAttributesProvided() {
- assertTrue(pip.attributesProvided().isEmpty());
- }
-
- @Test
- public void testIsRequestInvalid() {
- // valid issuer
- when(req.getIssuer()).thenReturn(ISSUER);
- assertFalse(pip.isRequestInvalid(req));
-
- // invalid issuer
- when(req.getIssuer()).thenReturn("bogus-issuer");
- assertTrue(pip.isRequestInvalid(req));
-
- // null issuer
- when(req.getIssuer()).thenReturn(null);
- assertTrue(pip.isRequestInvalid(req));
- }
-
- @Test
- public void testGetActor() {
- testGetArbitraryAttribute(StdOnapPip.PIP_REQUEST_ACTOR, pip2 -> pip2.getActor(finder));
- }
-
- @Test
- public void testGetRecipe() {
- testGetArbitraryAttribute(StdOnapPip.PIP_REQUEST_RECIPE, pip2 -> pip2.getRecipe(finder));
- }
-
- @Test
- public void testGetTarget() {
- testGetArbitraryAttribute(StdOnapPip.PIP_REQUEST_TARGET, pip2 -> pip2.getTarget(finder));
- }
-
- private void testGetArbitraryAttribute(PIPRequest request, Function<StdOnapPip, String> getter) {
- // target found
- pip = new MyPip() {
- @Override
- protected PIPResponse getAttribute(PIPRequest pipRequest, PIPFinder pipFinder) {
- return resp;
- }
-
- @Override
- protected String findFirstAttributeValue(PIPResponse pipResponse) {
- return A_VALUE;
- }
- };
-
- pip = spy(pip);
-
- assertEquals(A_VALUE, getter.apply(pip));
- verify(pip).getAttribute(request, finder);
- verify(pip).findFirstAttributeValue(resp);
-
-
- // not found
- pip = new MyPip() {
- @Override
- protected PIPResponse getAttribute(PIPRequest pipRequest, PIPFinder pipFinder) {
- return null;
- }
-
- @Override
- protected String findFirstAttributeValue(PIPResponse pipResponse) {
- return A_VALUE;
- }
- };
-
- pip = spy(pip);
-
- assertNull(getter.apply(pip));
- verify(pip).getAttribute(request, finder);
- verify(pip, never()).findFirstAttributeValue(resp);
- }
-
- @Test
- public void testGetAttribute() throws PIPException {
- when(finder.getMatchingAttributes(req, pip)).thenReturn(resp);
-
- Status status = mock(Status.class);
- Identifier ident = mock(Identifier.class);
-
- when(ident.stringValue()).thenReturn("my-attr-id");
- when(req.getAttributeId()).thenReturn(ident);
-
- // status != OK
- resp.setStatus(status);
- when(status.isOk()).thenReturn(false);
- assertNull(pip.getAttribute(req, finder));
-
- // status OK, empty attributes
- resp.setStatus(status);
- when(status.isOk()).thenReturn(true);
- assertNull(pip.getAttribute(req, finder));
-
- // status OK, has attributes
- resp.setStatus(status);
- when(status.isOk()).thenReturn(true);
- resp.setAttributes(Arrays.asList(mock(Attribute.class)));
- assertSame(resp, pip.getAttribute(req, finder));
-
- // null status, has attributes
- resp.setStatus(null);
- resp.setAttributes(Arrays.asList(mock(Attribute.class)));
- assertSame(resp, pip.getAttribute(req, finder));
-
- // with exception
- when(finder.getMatchingAttributes(req, pip)).thenThrow(new PIPException());
- assertNull(pip.getAttribute(req, finder));
- }
-
- @Test
- public void testFindFirstAttributeValue() {
-
- // no attributes
- resp.setAttributes(Collections.emptyList());
- assertNull(pip.findFirstAttributeValue(resp));
-
- // attribute that returns null
- Attribute attr = mock(Attribute.class);
- resp.setAttributes(Arrays.asList(attr, attr));
- assertNull(pip.findFirstAttributeValue(resp));
-
- // attribute that returns a list of null values
- Attribute attr2 = mock(Attribute.class);
- resp.setAttributes(Arrays.asList(attr, attr2));
- List<AttributeValue<String>> lst = Arrays.asList(makeAttr(null), makeAttr(null));
- when(attr.findValues(DataTypes.DT_STRING)).thenReturn(lst.iterator());
- assertNull(pip.findFirstAttributeValue(resp));
-
- // non-null value in the middle of the list
- lst = Arrays.asList(makeAttr(null), makeAttr(A_VALUE), makeAttr(null));
- when(attr.findValues(DataTypes.DT_STRING)).thenReturn(lst.iterator());
- assertEquals(A_VALUE, pip.findFirstAttributeValue(resp));
- }
-
- private AttributeValue<String> makeAttr(String value) {
- @SuppressWarnings("unchecked")
- AttributeValue<String> attrval = mock(AttributeValue.class);
-
- when(attrval.getValue()).thenReturn(value);
-
- return attrval;
- }
-
- @Test
- public void testAddIntegerAttribute() {
- resp = spy(resp);
-
- Identifier cat = mock(Identifier.class);
- Identifier attrid = mock(Identifier.class);
-
- pip.addIntegerAttribute(resp, cat, attrid, 100, req);
-
- verify(resp).addAttribute(any());
-
- // try with exception
- doThrow(new RuntimeException(EXPECTED_EXCEPTION)).when(resp).addAttribute(any());
- pip.addIntegerAttribute(resp, cat, attrid, 100, req);
- }
-
- @Test
- public void testAddStringAttribute() {
- resp = spy(resp);
-
- Identifier cat = mock(Identifier.class);
- Identifier attrid = mock(Identifier.class);
-
- pip.addStringAttribute(resp, cat, attrid, A_VALUE, req);
-
- verify(resp).addAttribute(any());
-
- // try with exception
- doThrow(new RuntimeException(EXPECTED_EXCEPTION)).when(resp).addAttribute(any());
- pip.addStringAttribute(resp, cat, attrid, A_VALUE, req);
- }
-
- private class MyPip extends StdOnapPip {
-
- @Override
- public Collection<PIPRequest> attributesRequired() {
- return Collections.emptyList();
- }
-
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPFinder pipFinder) throws PIPException {
- return null;
- }
-
- }
-}
diff --git a/controlloop/common/database/src/test/resources/META-INF/persistence.xml b/controlloop/common/database/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index 202850d96..000000000
--- a/controlloop/common/database/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ONAP
- ================================================================================
- Copyright (C) 2019 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============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-unit name="PipEngineTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.database.operationshistory.Dbao</class>
-
- <properties>
- <property name="eclipselink.ddl-generation" value="create-tables" />
- <property name="eclipselink.logging.level" value="FINE" />
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
- <property name="javax.persistence.jdbc.user" value="policy" />
- <property name="javax.persistence.jdbc.password" value="P01icY" />
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
- <property name="javax.persistence.schema-generation.create-source" value="metadata" />
- </properties>
- </persistence-unit>
-
-</persistence>
diff --git a/controlloop/common/database/src/test/resources/test.properties b/controlloop/common/database/src/test/resources/test.properties
deleted file mode 100644
index fb3d3ce53..000000000
--- a/controlloop/common/database/src/test/resources/test.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Properties that the embedded PDP engine uses to configure and load
-#
-# Standard API Factories
-#
-xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory
-xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory
-xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory
-xacml.pipFinderFactory=com.att.research.xacml.std.pip.StdPIPFinderFactory
-xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory
-#
-# AT&T PDP Implementation Factories
-#
-xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory
-xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory
-xacml.att.functionDefinitionFactory=com.att.research.xacmlatt.pdp.std.StdFunctionDefinitionFactory
-#
-# ONAP PDP Implementation Factories
-#
-xacml.att.policyFinderFactory=org.onap.policy.pdp.xacml.application.common.OnapPolicyFinderFactory
-
-#
-#
-#
-xacml.rootPolicies=rootstart
-rootstart.file=src/test/resources/root.xml
-
-xacml.referencedPolicies=refstart1,refstart2,refstart3,refstart4
-refstart1.file=src/test/resources/ref1.xml
-refstart2.file=src/test/resources/ref2.xml
-refstart3.file=src/test/resources/ref3.xml
-refstart4.file=src/test/resources/ref4.xml
-
-#
-# Database persistence for PIP
-#
-count-recent-operations.persistenceunit=PipEngineTest
-get-operation-outcome.persistenceunit=PipEngineTest
diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml
index 00e3c79df..aa4f8e8bb 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -105,11 +105,6 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>database</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
<artifactId>guard</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -134,6 +129,11 @@
</dependency>
<dependency>
<groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>guard</artifactId>
+ <version>${policy.models.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
<artifactId>vfc</artifactId>
<version>${policy.models.version}</version>
<scope>provided</scope>
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index 2a5e64d97..d0c19ba67 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -64,8 +64,8 @@ import org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.policy.TargetType;
-import org.onap.policy.database.operationshistory.Dbao;
import org.onap.policy.drools.system.PolicyEngineConstants;
+import org.onap.policy.guard.OperationsHistory;
import org.onap.policy.guard.Util;
import org.onap.policy.sdnc.SdncResponse;
import org.onap.policy.sdnr.PciResponseWrapper;
@@ -1093,7 +1093,7 @@ public class ControlLoopOperationManager implements Serializable {
return;
}
- Dbao newEntry = new Dbao();
+ OperationsHistory newEntry = new OperationsHistory();
newEntry.setClosedLoopName(this.onset.getClosedLoopControlName());
newEntry.setRequestId(this.onset.getRequestId().toString());
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
index 2b67865bf..741ce20f8 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
@@ -39,7 +39,7 @@ import org.onap.policy.common.utils.jpa.EntityMgrCloser;
import org.onap.policy.common.utils.jpa.EntityTransCloser;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.database.operationshistory.Dbao;
+import org.onap.policy.guard.OperationsHistory;
import org.onap.policy.guard.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -261,15 +261,15 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
logger.info("store operation history record for {}", event.getRequestId());
- List<Dbao> results =
- entityMgr.createQuery("select e from Dbao e"
+ List<OperationsHistory> results =
+ entityMgr.createQuery("select e from OperationsHistory e"
+ " where e.closedLoopName= ?1"
+ " and e.requestId= ?2"
+ " and e.subrequestId= ?3"
+ " and e.actor= ?4"
+ " and e.operation= ?5"
+ " and e.target= ?6",
- Dbao.class)
+ OperationsHistory.class)
.setParameter(1, event.getClosedLoopControlName())
.setParameter(2, record.getRequestId())
.setParameter(3, operation.getSubRequestId())
@@ -282,7 +282,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
logger.warn("unexpected operation history record count {} for {}", results.size(), event.getRequestId());
}
- Dbao entry = (results.isEmpty() ? new Dbao() : results.get(0));
+ OperationsHistory entry = (results.isEmpty() ? new OperationsHistory() : results.get(0));
entry.setClosedLoopName(event.getClosedLoopControlName());
entry.setRequestId(record.getRequestId());
diff --git a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
index 210e22f27..c3c633674 100644
--- a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
+++ b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
drools-applications
================================================================================
- Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018-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.
@@ -26,7 +26,7 @@
transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.database.operationshistory.Dbao</class>
+ <class>org.onap.policy.guard.OperationsHistory</class>
<properties>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
diff --git a/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml b/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml
index 4d47751bf..917f8aad3 100644
--- a/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml
+++ b/controlloop/common/eventmanager/src/test/resources/META-INF/persistence.xml
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- drools-applications
- ================================================================================
- Copyright (C) 2018-2019 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============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">
-
- <!-- In-mem DB for junit -->
- <persistence-unit name="OperationsHistoryPUTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.database.operationshistory.Dbao</class>
-
- <properties>
- <property name="eclipselink.ddl-generation" value="create-tables" />
- <property name="eclipselink.logging.level" value="INFO" />
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
- <property name="javax.persistence.jdbc.user" value="policy" />
- <property name="javax.persistence.jdbc.password" value="P01icY" />
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
- <property name="javax.persistence.schema-generation.create-source" value="metadata" />
- </properties>
- </persistence-unit>
-
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ drools-applications
+ ================================================================================
+ Copyright (C) 2018-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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============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">
+
+ <!-- In-mem DB for junit -->
+ <persistence-unit name="OperationsHistoryPUTest" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+ <class>org.onap.policy.guard.OperationsHistory</class>
+
+ <properties>
+ <property name="eclipselink.ddl-generation" value="create-tables" />
+ <property name="eclipselink.logging.level" value="INFO" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
+ <property name="javax.persistence.jdbc.user" value="policy" />
+ <property name="javax.persistence.jdbc.password" value="P01icY" />
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
+ <property name="javax.persistence.schema-generation.create-source" value="metadata" />
+ </properties>
+ </persistence-unit>
+
+</persistence>
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
index 611dd2d8b..0331b7aab 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-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.
@@ -24,7 +24,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.function.Supplier;
-
import org.drools.core.WorkingMemory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/controlloop/common/guard/src/main/resources/META-INF/persistence.xml b/controlloop/common/guard/src/main/resources/META-INF/persistence.xml
index fa75ef268..cf7e28190 100644
--- a/controlloop/common/guard/src/main/resources/META-INF/persistence.xml
+++ b/controlloop/common/guard/src/main/resources/META-INF/persistence.xml
@@ -3,14 +3,14 @@
============LICENSE_START=======================================================
drools-applications
================================================================================
- Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018-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.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,11 +22,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
-
+
<persistence-unit name="OperationsHistoryPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.database.operationshistory.Dbao</class>
+ <class>org.onap.policy.guard.OperationsHistory</class>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
@@ -39,5 +39,5 @@
<property name="javax.persistence.schema-generation.create-source" value="metadata"/>
</properties>
</persistence-unit>
-
+
</persistence>
diff --git a/controlloop/common/guard/src/test/resources/META-INF/persistence.xml b/controlloop/common/guard/src/test/resources/META-INF/persistence.xml
index b6d80e099..8e8be4ed2 100644
--- a/controlloop/common/guard/src/test/resources/META-INF/persistence.xml
+++ b/controlloop/common/guard/src/test/resources/META-INF/persistence.xml
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- drools-applications
- ================================================================================
- Copyright (C) 2018-2019 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.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============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">
-
- <!-- In-mem DB for junit -->
- <persistence-unit name="OperationsHistoryPUTest"
- transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.database.operationshistory.Dbao</class>
-
- <properties>
- <property name="eclipselink.ddl-generation" value="create-tables" />
- <property name="eclipselink.logging.level" value="FINE" />
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
- <property name="javax.persistence.jdbc.user" value="policy" />
- <property name="javax.persistence.jdbc.password" value="P01icY" />
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
- <property name="javax.persistence.schema-generation.create-source" value="metadata"/>
- </properties>
- </persistence-unit>
-
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ drools-applications
+ ================================================================================
+ Copyright (C) 2018-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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============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">
+
+ <!-- In-mem DB for junit -->
+ <persistence-unit name="OperationsHistoryPUTest"
+ transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
+ <class>org.onap.policy.guard.OperationsHistory</class>
+
+ <properties>
+ <property name="eclipselink.ddl-generation" value="create-tables" />
+ <property name="eclipselink.logging.level" value="FINE" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE" />
+ <property name="javax.persistence.jdbc.user" value="policy" />
+ <property name="javax.persistence.jdbc.password" value="P01icY" />
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+ <property name="javax.persistence.schema-generation.create-source" value="metadata"/>
+ </properties>
+ </persistence-unit>
+
+</persistence>
diff --git a/controlloop/common/pom.xml b/controlloop/common/pom.xml
index 6fc0654f4..4b5c5ece7 100644
--- a/controlloop/common/pom.xml
+++ b/controlloop/common/pom.xml
@@ -33,7 +33,6 @@
<artifactId>drools-applications-common</artifactId>
<modules>
- <module>database</module>
<module>guard</module>
<module>coordination</module>
<module>eventmanager</module>
diff --git a/controlloop/m2/guard/pom.xml b/controlloop/m2/guard/pom.xml
index d32d97902..1683bbb20 100644
--- a/controlloop/m2/guard/pom.xml
+++ b/controlloop/m2/guard/pom.xml
@@ -58,9 +58,9 @@
</dependency>
<dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <artifactId>database</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>guard</artifactId>
+ <version>${policy.models.version}</version>
</dependency>
<dependency>
diff --git a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
index d0d1b831f..a0d159150 100644
--- a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
+++ b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
@@ -28,23 +28,19 @@ import java.util.HashMap;
import java.util.Properties;
import java.util.UUID;
import java.util.function.Supplier;
-
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-
import org.drools.core.WorkingMemory;
-
-import org.onap.policy.database.operationshistory.Dbao;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.core.PolicyContainer;
import org.onap.policy.drools.core.PolicySession;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyControllerConstants;
import org.onap.policy.drools.system.PolicyEngineConstants;
+import org.onap.policy.guard.OperationsHistory;
import org.onap.policy.guard.Util;
import org.onap.policy.util.DroolsSessionCommonSerializable;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -317,7 +313,7 @@ public class GuardContext implements Serializable {
em = createEntityManager();
// create the new DB table entry
- Dbao newEntry = new Dbao();
+ OperationsHistory newEntry = new OperationsHistory();
// populate the new DB table entry
newEntry.setClosedLoopName(closedLoopControlName);