summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate')
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml99
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java275
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/package-info.java28
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/css/site.css100
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/images/logos.pngbin162383 -> 0 bytes
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/site.xml28
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java253
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/resources/META-INF/persistence.xml42
8 files changed, 0 insertions, 825 deletions
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml
deleted file mode 100644
index ae2def8d2..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<!-- ============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved. Modifications Copyright
- (C) 2019 Nordix Foundation. ================================================================================
- 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========================================================= -->
-<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.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa</groupId>
- <artifactId>plugins-persistence-jpa</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>plugins-persistence-jpa-hibernate</artifactId>
- <name>${project.artifactId}</name>
- <description>[${project.parent.artifactId}] Plugin for persistence using Hibernate</description>
-
- <dependencies>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${version.hibernate}</version>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.javassist</groupId>
- <artifactId>javaassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.activation</groupId>
- <artifactId>javax.activation-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.4.01</version>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- <version>1.8.13</version>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.22.0-GA</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-c3p0</artifactId>
- <version>${version.hibernate}</version>
- <exclusions>
- <exclusion>
- <groupId>com.mchange</groupId>
- <artifactId>c3p0</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.mchange</groupId>
- <artifactId>c3p0</artifactId>
- <version>0.9.5.3</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>apexSite</id>
- <activation>
- <property>
- <name>apexSite</name>
- </property>
- </activation>
- <distributionManagement>
- <site>
- <id>${project.artifactId}-site</id>
- <url>${apex.adsite.prefix}/modules/plugins/plugins-persistence/${project.parent.artifactId}/${project.artifactId}/</url>
- </site>
- </distributionManagement>
- </profile>
- </profiles>
-</project>
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java
deleted file mode 100644
index 19ad01054..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDao.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. 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.apex.plugins.persistence.jpa.hibernate;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class HibernateApexDao is the Hibernate JPA implementation of the Apex DAO.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class HibernateApexDao extends DefaultApexDao {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(HibernateApexDao.class);
-
- private static final String FROM = "FROM ";
- private static final String DELETE_FROM = "DELETE FROM ";
- private static final String WHERE_KEY_NAME = " WHERE key.name='";
- private static final String AND_KEY_VERSION = "' AND key.version='";
- private static final String WHERE_KEY_PARENT_KEY_NAME = " WHERE key.parentKeyName='";
- private static final String AND_KEY_PARENT_KEY_VERSION = "' AND key.parentKeyVersion='";
- private static final String AND_KEY_LOCAL_NAME = "' AND key.localName='";
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao#delete(java.lang.Class,
- * org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> void delete(final Class<T> clazz, final AxArtifactKey key) {
- if (key == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + clazz.getSimpleName() + WHERE_KEY_NAME + key.getName() + AND_KEY_VERSION
- + key.getVersion() + "'").executeUpdate();
- mg.getTransaction().commit();
- } finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao#delete(java.lang.Class,
- * org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey)
- */
- @Override
- public <T extends AxConcept> void delete(final Class<T> clazz, final AxReferenceKey key) {
- if (key == null) {
- return;
- }
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + clazz.getSimpleName() + WHERE_KEY_PARENT_KEY_NAME + key.getParentKeyName()
- + AND_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_KEY_LOCAL_NAME
- + key.getLocalName() + "'").executeUpdate();
- mg.getTransaction().commit();
- } finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao#deleteByArtifactKey(java.lang.Class,
- * java.util.Collection)
- */
- @Override
- public <T extends AxConcept> int deleteByArtifactKey(final Class<T> clazz, final Collection<AxArtifactKey> keys) {
- if (keys == null || keys.isEmpty()) {
- return 0;
- }
- int deletedCount = 0;
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final AxArtifactKey key : keys) {
- deletedCount += mg.createQuery(DELETE_FROM + clazz.getSimpleName() + WHERE_KEY_NAME + key.getName()
- + AND_KEY_VERSION + key.getVersion() + "'").executeUpdate();
- }
- mg.getTransaction().commit();
- } finally {
- mg.close();
- }
- return deletedCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#deleteByContextUsageKey(java.lang.Class, java.util.Collection)
- */
- @Override
- public <T extends AxConcept> int deleteByReferenceKey(final Class<T> clazz, final Collection<AxReferenceKey> keys) {
- if (keys == null || keys.isEmpty()) {
- return 0;
- }
- int deletedCount = 0;
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- for (final AxReferenceKey key : keys) {
- deletedCount += mg.createQuery(DELETE_FROM + clazz.getSimpleName() + WHERE_KEY_PARENT_KEY_NAME
- + key.getParentKeyName() + AND_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
- + AND_KEY_LOCAL_NAME + key.getLocalName() + "'").executeUpdate();
- }
- mg.getTransaction().commit();
- } finally {
- mg.close();
- }
- return deletedCount;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#deleteAll(java.lang.Class)
- */
- @Override
- public <T extends AxConcept> void deleteAll(final Class<T> clazz) {
- final EntityManager mg = getEntityManager();
- try {
- mg.getTransaction().begin();
- mg.createQuery(DELETE_FROM + clazz.getSimpleName()).executeUpdate();
- mg.getTransaction().commit();
- } finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#getAll(java.lang.Class)
- */
- @Override
- public <T extends AxConcept> List<T> getAll(final Class<T> clazz) {
- if (clazz == null) {
- return Collections.emptyList();
- }
- final EntityManager mg = getEntityManager();
- try {
- final List<T> result = mg.createQuery(FROM + clazz.getSimpleName(), clazz).getResultList();
- final List<T> cloneResult = new ArrayList<>();
- for (final T t : result) {
- try {
- final T clonedT = clazz.newInstance();
- t.copyTo(clonedT);
- cloneResult.add(clonedT);
- } catch (final Exception e) {
- LOGGER.warn("Could not clone object of class \"" + clazz.getCanonicalName() + "\"", e);
- return cloneResult;
- }
- }
- return cloneResult;
- } finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#getAll(java.lang.Class,
- * org.onap.policy.apex.core.model.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> List<T> getAll(final Class<T> clazz, final AxArtifactKey parentKey) {
- if (clazz == null) {
- return Collections.emptyList();
- }
- final EntityManager mg = getEntityManager();
- try {
- return mg.createQuery(FROM + clazz.getSimpleName() + WHERE_KEY_PARENT_KEY_NAME + parentKey.getName()
- + AND_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'", clazz).getResultList();
- } finally {
- mg.close();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#getArtifact(java.lang.Class,
- * org.onap.policy.apex.core.model.concepts.AxArtifactKey)
- */
- @Override
- public <T extends AxConcept> T getArtifact(final Class<T> clazz, final AxArtifactKey key) {
- if (clazz == null || key == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- List<T> ret;
- try {
- ret = mg.createQuery(FROM + clazz.getSimpleName() + WHERE_KEY_NAME + key.getName() + AND_KEY_VERSION
- + key.getVersion() + "'", clazz).getResultList();
- } finally {
- mg.close();
- }
- if (ret == null || ret.isEmpty()) {
- return null;
- }
- if (ret.size() > 1) {
- throw new IllegalArgumentException("More than one result was returned for search for " + clazz
- + " with key " + key.getId() + ": " + ret);
- }
- return ret.get(0);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.onap.policy.apex.core.model.dao.ApexDao#getArtifact(java.lang.Class,
- * org.onap.policy.apex.core.model.concepts.AxReferenceKey)
- */
- @Override
- public <T extends AxConcept> T getArtifact(final Class<T> clazz, final AxReferenceKey key) {
- if (clazz == null || key == null) {
- return null;
- }
- final EntityManager mg = getEntityManager();
- List<T> ret;
- try {
- ret = mg.createQuery(FROM + clazz.getSimpleName() + WHERE_KEY_PARENT_KEY_NAME + key.getParentKeyName()
- + AND_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion() + AND_KEY_LOCAL_NAME
- + key.getLocalName() + "'", clazz).getResultList();
- } finally {
- mg.close();
- }
- if (ret == null || ret.isEmpty()) {
- return null;
- }
- if (ret.size() > 1) {
- throw new IllegalArgumentException("More than one result was returned for search for " + clazz
- + " with key " + key.getId() + ": " + ret);
- }
- return ret.get(0);
- }
-}
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/package-info.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/package-info.java
deleted file mode 100644
index 036d45d5d..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/main/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. 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=========================================================
- */
-
-/**
- * Provides the <a href="http://hibernate.org/">Hibernate</a> implementation on the APEX DAO for persistence over
- * <a href="https://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC</a>.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.plugins.persistence.jpa.hibernate;
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/css/site.css b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/css/site.css
deleted file mode 100644
index ef8bd4d15..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/css/site.css
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. 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=========================================================
- */
-
-@import url(http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.0/css/font-awesome.css);
-
-
-/*************** Table definitions *******************/
-
-tableblock > .title, .tableblock > caption { line-height: 1.4; color: #7a2518; font-weight: 300; margin-top: 0.2em; margin-bottom: 0.5em; }
-
-.tableblock > caption { text-align: left; font-weight: bold; white-space: nowrap; overflow: visible; max-width: 0; }
-
-table.tableblock { background: white; margin-bottom: 1.25em; border: solid 1px #dddddd; }
-table.tableblock thead, table.tableblock tfoot { background: whitesmoke; font-weight: bold; }
-table.tableblock thead tr th, table.tableblock thead tr td, table tfoot tr th, table tfoot tr td { padding: 0.5em 0.625em 0.625em; font-size: inherit; color: #222222; text-align: left; }
-table.tableblock tr th, table.tableblock tr td { padding: 0.5625em 0.625em; font-size: inherit; color: #222222; }
-table.tableblock tr.even, table.tableblock tr.alt, table.tableblock tr:nth-of-type(even) { background: #f9f9f9; }
-table.tableblock thead tr th, table.tableblock tfoot tr th, table.tableblock tbody tr td, table.tableblock tr td, table.tableblock tfoot tr td { display: table-cell; line-height: 1.6; }
-
-table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-size: inherit; }
-
-table.tableblock.grid-all { border-collapse: separate; border-spacing: 1px; -webkit-border-radius: 4px; border-radius: 4px; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; }
-
-table.tableblock.frame-topbot, table.tableblock.frame-none { border-left: 0; border-right: 0; }
-
-table.tableblock.frame-sides, table.tableblock.frame-none { border-top: 0; border-bottom: 0; }
-
-table.tableblock td .paragraph:last-child p, table.tableblock td > p:last-child { margin-bottom: 0; }
-
-th.tableblock.halign-left, td.tableblock.halign-left { text-align: left; }
-
-th.tableblock.halign-right, td.tableblock.halign-right { text-align: right; }
-
-th.tableblock.halign-center, td.tableblock.halign-center { text-align: center; }
-
-th.tableblock.valign-top, td.tableblock.valign-top { vertical-align: top; }
-
-th.tableblock.valign-bottom, td.tableblock.valign-bottom { vertical-align: bottom; }
-
-th.tableblock.valign-middle, td.tableblock.valign-middle { vertical-align: middle; }
-
-p.tableblock.header { color: #222222; font-weight: bold; }
-
-
-
-/*************** KBD Macro definitions *******************/
-
-kbd.keyseq { color: #555555; }
-
-kbd:not(.keyseq) { display: inline-block; color: #222222; font-size: 0.75em; line-height: 1.4; background-color: #F7F7F7; border: 1px solid #ccc; -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; margin: -0.15em 0.15em 0 0.15em; padding: 0.2em 0.6em 0.2em 0.5em; vertical-align: middle; white-space: nowrap; }
-
-kbd kbd:first-child { margin-left: 0; }
-
-kbd kbd:last-child { margin-right: 0; }
-
-
-/*************** Admontion Blocks definitions *******************/
-.admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .videoblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { text-align: left; font-weight: bold; }
-
-.admonitionblock > table { border: 0; background: none; width: 100%; margin-top: 1em; margin-bottom: 1em;}
-.admonitionblock > table td.icon { text-align: center; width: 80px; }
-.admonitionblock > table td.icon img { max-width: none; }
-.admonitionblock > table td.icon .title { font-weight: bold; text-transform: uppercase; }
-.admonitionblock > table td.content { padding-left: 1.125em; padding-right: 1.25em; border-left: 1px solid #dddddd; color: #6f6f6f; }
-.admonitionblock > table td.content > :last-child > :last-child { margin-bottom: 0; }
-
-.admonitionblock td.icon [class^="fa icon-"]:before {font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
-.admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #005498; color: #003f72; }
-.admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #111; }
-.admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; }
-.admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; }
-.admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; }
-
-
-
-/*************** Misc definitions *******************/
-
-*:not(pre) > code { font-size: 0.9375em; padding: 1px 3px 0; white-space: nowrap; background-color: #f2f2f2; border: 1px solid #cccccc; -webkit-border-radius: 4px; border-radius: 4px; text-shadow: none; }
-
-pre, pre > code { line-height: 1.4; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; }
-
-code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #6d180b; }
-
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/images/logos.png b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/images/logos.png
deleted file mode 100644
index 915d6e59d..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/images/logos.png
+++ /dev/null
Binary files differ
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/site.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/site.xml
deleted file mode 100644
index e8b9f0f78..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/site/site.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. All rights reserved.
- ================================================================================
- This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
- Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-
- SPDX-License-Identifier: CC-BY-4.0
- ============LICENSE_END=========================================================
-
- @author Sven van der Meer (sven.van.der.meer@ericsson.com)
-
--->
-
-<project name="APEX Plugins Persistence JPA Hibernate">
- <body>
- <menu name="APEX Plugins Persistence JPA Hibernate">
- <item href="javadocs/index.html" name="API Doc" />
- </menu>
- <menu ref="reports" inherit="top" />
- <menu ref="modules" />
-
- <breadcrumbs>
- <item name="Hibernate" href="index.html" />
- </breadcrumbs>
- </body>
-</project> \ No newline at end of file
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java
deleted file mode 100644
index e96c8ea49..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/hibernate/HibernateApexDaoTest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. 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.apex.plugins.persistence.jpa.hibernate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.test.entities.ArtifactKeyTestEntity;
-import org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
-
-/**
- * Junit test for class HibernateApexDao.
- *
- * @author Dinh Danh Le (dinh.danh.le@ericsson.com)
- *
- */
-
-public class HibernateApexDaoTest {
- private static final List<AxArtifactKey> TEST_ARTIKEYS = Arrays.asList(new AxArtifactKey[] {
- new AxArtifactKey("ABC", "0.0.1"),
- new AxArtifactKey("DEF", "0.1.1"), new AxArtifactKey("XYZ", "1.1.1")
- });
-
- private final DaoParameters daoParameters = new DaoParameters();
-
- private HibernateApexDao hibernateApexDao = null;
-
- /**
- * Set up tests.
- *
- * @throws ApexException on test setup errors
- */
- @Before
- public void setupDao() throws ApexException {
- daoParameters.setPluginClass(HibernateApexDao.class.getCanonicalName());
- daoParameters.setPersistenceUnit("DAOTest");
- hibernateApexDao = new HibernateApexDao();
- hibernateApexDao.init(daoParameters);
- }
-
- /**
- * Cleardown tests.
- */
- @After
- public void teardownDao() {
- hibernateApexDao.close();
- }
-
- @Test
- public void test_NullArguments() {
- final AxArtifactKey nullArtifactKey = null;
- final AxArtifactKey nullRefernceKey = null;
- final List<Object> emptyList = Collections.emptyList();
-
- assertNull(hibernateApexDao.getArtifact(null, nullArtifactKey));
- assertNull(hibernateApexDao.getArtifact(ArtifactKeyTestEntity.class, nullArtifactKey));
-
- assertNull(hibernateApexDao.getArtifact(null, nullRefernceKey));
- assertNull(hibernateApexDao.getArtifact(ReferenceKeyTestEntity.class, nullRefernceKey));
-
- assertNotNull(hibernateApexDao.getAll(null));
- assertTrue(hibernateApexDao.getAll(null).equals(emptyList));
- assertNotNull(hibernateApexDao.getAll(ReferenceKeyTestEntity.class));
- }
-
- @Test
- public void test_createObject() throws ApexException {
- // create 3 more entities from testArtiKeys
- for (final AxArtifactKey akey : TEST_ARTIKEYS) {
- hibernateApexDao.create(new ReferenceKeyTestEntity(new AxReferenceKey(akey), Math.random() + 100.0));
- }
- assertEquals(3, hibernateApexDao.getAll(ReferenceKeyTestEntity.class).size());
- }
-
- @Test
- public void test_getAll() {
- // create a list of three entities from testArtiKeys
- final double[] genDoubleVals = new double[TEST_ARTIKEYS.size()];
-
- for (int i = 0; i < TEST_ARTIKEYS.size(); i++) {
- final AxArtifactKey akey = TEST_ARTIKEYS.get(i);
- genDoubleVals[i] = Math.random();
- hibernateApexDao.create(new ReferenceKeyTestEntity(new AxReferenceKey(akey), genDoubleVals[i]));
- }
-
- final List<ReferenceKeyTestEntity> ret = hibernateApexDao.getAll(ReferenceKeyTestEntity.class);
- assertEquals(TEST_ARTIKEYS.size(), ret.size());
-
- for (int i = 0; i < TEST_ARTIKEYS.size(); i++) {
- final ReferenceKeyTestEntity e = ret.get(i);
- assertEquals(TEST_ARTIKEYS.get(i), e.getKey().getParentArtifactKey());
- assertEquals(genDoubleVals[i], e.getDoubleValue(), 0.0);
- }
- }
-
- @Test
- public void test_getArtifactByReferenceKey() {
- final AxArtifactKey artifactKey = new AxArtifactKey("XXX", "0.0.1");
- final AxReferenceKey referenceKey = new AxReferenceKey(artifactKey, "Entity1");
-
- // assert null if Entity Class is null
- assertNull(hibernateApexDao.getArtifact(null, referenceKey));
-
- // create PersistenceContext with an entity
- hibernateApexDao.create(new ReferenceKeyTestEntity(referenceKey, 1.0));
- // assert null when trying to find an entity with an unknown key
- final AxArtifactKey anotherArtifactKey = new AxArtifactKey("YYY", "0.0.2");
- final AxReferenceKey anotherReferenceKey = new AxReferenceKey(anotherArtifactKey);
-
- assertNull(hibernateApexDao.getArtifact(ReferenceKeyTestEntity.class, anotherReferenceKey));
-
- // assert return only one entity when finding an entity with correct key
- final ReferenceKeyTestEntity retEntity = hibernateApexDao.getArtifact(ReferenceKeyTestEntity.class,
- referenceKey);
- assertEquals(referenceKey, retEntity.getKey());
- }
-
- @Test
- public void test_getArtifactByArtifactKey() {
- final AxArtifactKey artifactKey = new AxArtifactKey("XXX", "0.0.1");
- // assert null if either Entity Class is null
- assertNull(hibernateApexDao.getArtifact(null, artifactKey));
- // create an entity
- hibernateApexDao.create(new ArtifactKeyTestEntity(artifactKey, 1.0));
-
- // assert null when trying to find an entity with an unknown key
- final AxArtifactKey otherArtifactKey = new AxArtifactKey("YYY", "0.0.2");
- assertNull(hibernateApexDao.getArtifact(ArtifactKeyTestEntity.class, otherArtifactKey));
-
- // assert return only one entity when finding an entity with correct key
- final ArtifactKeyTestEntity retEntity = hibernateApexDao.getArtifact(ArtifactKeyTestEntity.class, artifactKey);
- assertNotNull(retEntity);
- assertEquals(artifactKey, retEntity.getKey());
- }
-
- @Test
- public void test_deleteByArtifactKey() {
- // initialize a list of (3) entities corresponding to the list of testArtiKeys
- for (final AxArtifactKey akey : TEST_ARTIKEYS) {
- hibernateApexDao.create(new ArtifactKeyTestEntity(akey, Math.random()));
- }
- // create one more entity
- final ArtifactKeyTestEntity entity = new ArtifactKeyTestEntity(new AxArtifactKey("XYZ", "100.0.0"), 100.0);
- hibernateApexDao.create(entity);
-
- assertEquals(3, hibernateApexDao.deleteByArtifactKey(ArtifactKeyTestEntity.class, TEST_ARTIKEYS));
-
- // after deleteByArtifactKey()--> getAll().size() == 1
- final List<ArtifactKeyTestEntity> remainingEntities = hibernateApexDao.getAll(ArtifactKeyTestEntity.class);
- assertEquals(1, remainingEntities.size());
- // more details about the remainingEntities
- assertEquals(100.0, remainingEntities.get(0).getDoubleValue(), 0.0);
- }
-
- @Test
- public void test_deleteByReferenceKey() {
- // prepare 2 AxArtifactKeys
- final AxArtifactKey owner0Key = new AxArtifactKey("Owner0", "0.0.1");
- final AxArtifactKey owner1Key = new AxArtifactKey("Owner1", "0.0.1");
-
- // prepare a list of (3) AxReferenceKeys corresponding to owner0Key
- final List<AxReferenceKey> refKey0s = Arrays.asList(new AxReferenceKey[] {
- new AxReferenceKey(owner0Key, "Entity01"), new AxReferenceKey(owner0Key, "Entity02"),
- new AxReferenceKey(owner0Key, "Entity03")
- });
- // prepare 2 more AxReferenceKeys corresponding to owner1Key
- final AxReferenceKey refKey11 = new AxReferenceKey(owner1Key, "Entity11");
- final AxReferenceKey refKey12 = new AxReferenceKey(owner1Key, "Entity12");
-
- // create a list of 5 entities
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey0s.get(0), 101.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey0s.get(1), 102.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey0s.get(2), 103.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey11, 104.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey12, 105.0));
-
- // assert 3 entities are deleted by this deletion
- assertEquals(3, hibernateApexDao.deleteByReferenceKey(ReferenceKeyTestEntity.class, refKey0s));
- // after deletion, make sure getAll().size() == 2
- assertEquals(2, hibernateApexDao.getAll(ReferenceKeyTestEntity.class).size());
- }
-
- @Test
- public void test_deleteAll() {
- // initialize a list of (3) entities and add to the PersistenceContext
- for (final AxArtifactKey akey : TEST_ARTIKEYS) {
- hibernateApexDao.create(new ReferenceKeyTestEntity(new AxReferenceKey(akey), Math.random()));
- }
- // before deleteAll()--> getAll().size() == 3
- assertEquals(3, hibernateApexDao.getAll(ReferenceKeyTestEntity.class).size());
- hibernateApexDao.deleteAll(ReferenceKeyTestEntity.class);
- // after deleteAll()--> getAll().size() == 0
- assertEquals(0, hibernateApexDao.getAll(ReferenceKeyTestEntity.class).size());
- }
-
- @Test
- public void test_getAllByArtifactKey() {
-
- final AxArtifactKey artiKey0 = new AxArtifactKey("XYZA", "0.1.2");
- final AxArtifactKey artiKey1 = new AxArtifactKey("ONAP", "0.0.1");
-
- final AxReferenceKey refKey0 = new AxReferenceKey(artiKey0, "Entity0");
- final AxReferenceKey refKey1 = new AxReferenceKey(artiKey1, "Entity1");
-
- // test with null class with known key --> return an empty list
- assertNotNull(hibernateApexDao.getAll(null, artiKey1));
- assertTrue(hibernateApexDao.getAll(null, artiKey1).equals(Collections.emptyList()));
-
- // test with (not_null) ArtifactKeyTestEntity class
- assertEquals(0, hibernateApexDao.getAll(ReferenceKeyTestEntity.class, artiKey0).size());
- // create 2 entities
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey0, 100.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey0, 200.0));
- hibernateApexDao.create(new ReferenceKeyTestEntity(refKey1, 100.0));
-
- final List<ReferenceKeyTestEntity> ret = hibernateApexDao.getAll(ReferenceKeyTestEntity.class, artiKey0);
- assertEquals(1, ret.size());
- final ReferenceKeyTestEntity retEntity = ret.get(0);
- assertEquals(200.0, retEntity.getDoubleValue(), 0);
- }
-
-}
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/resources/META-INF/persistence.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index ee38e0096..000000000
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-hibernate/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. 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=========================================================
--->
-<!-- This is to configure H2-IMDB using Hibernate-->
-
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
-
- <class>org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity</class>
- <class>org.onap.policy.apex.context.test.entities.ArtifactKeyTestEntity</class>
-
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
- <property name="hibernate.connection.driver_class" value="org.h2.Driver" />
- <property name="hibernate.connection.url" value="jdbc:h2:mem:test" />
- <property name="hibernate.connection.user" value="sa" />
- <property name="hibernate.connection.user.password" value="" />
- <property name="hibernate.show_sql" value="true" />
- <property name="hibernate.flushMode" value="FLUSH_AUTO" />
- <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
- <property name="hibernate.hbm2ddl.auto" value="create-drop" />
- </properties>
- </persistence-unit>
-</persistence> \ No newline at end of file