summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--integrity-audit/pom.xml13
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java8
-rw-r--r--integrity-audit/src/main/resources/META-INF/persistence.xml49
-rw-r--r--integrity-monitor/pom.xml8
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java12
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java10
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java11
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java12
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java2
-rw-r--r--integrity-monitor/src/main/resources/META-INF/persistence.xml (renamed from integrity-monitor/src/main/resources/META-INF/persistenceIM.xml)8
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java2
-rw-r--r--utils/pom.xml4
12 files changed, 71 insertions, 68 deletions
diff --git a/integrity-audit/pom.xml b/integrity-audit/pom.xml
index edb4f2d9..18f5536a 100644
--- a/integrity-audit/pom.xml
+++ b/integrity-audit/pom.xml
@@ -19,10 +19,7 @@
============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">
+<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>
@@ -68,8 +65,12 @@
<artifactId>h2</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
index 37688859..07b85579 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
@@ -3,6 +3,7 @@
* Integrity Audit
* ================================================================================
* Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
@@ -46,8 +48,10 @@ import org.onap.policy.common.ia.AuditorTime;
@Entity
@Table(name = "IntegrityAuditEntity")
-@NamedQuery(name = " IntegrityAuditEntity.findAll", query = "SELECT e FROM IntegrityAuditEntity e ")
-@NamedQuery(name = "IntegrityAuditEntity.deleteAll", query = "DELETE FROM IntegrityAuditEntity WHERE 1=1")
+@NamedQueries({
+ @NamedQuery(name = " IntegrityAuditEntity.findAll", query = "SELECT e FROM IntegrityAuditEntity e "),
+ @NamedQuery(name = "IntegrityAuditEntity.deleteAll", query = "DELETE FROM IntegrityAuditEntity WHERE 1=1")
+})
@NoArgsConstructor
@Getter
@Setter
diff --git a/integrity-audit/src/main/resources/META-INF/persistence.xml b/integrity-audit/src/main/resources/META-INF/persistence.xml
index 33c701b1..b648cd63 100644
--- a/integrity-audit/src/main/resources/META-INF/persistence.xml
+++ b/integrity-audit/src/main/resources/META-INF/persistence.xml
@@ -4,13 +4,14 @@
Integrity Audit
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 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.
@@ -19,28 +20,26 @@
============LICENSE_END=========================================================
-->
-<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
- <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
- <!-- Limited use for generating the DB and schema files for iatest DB -
- uses eclipselink -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
- <class>org.onap.policy.common.ia.jpa.IaTestEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <property name="javax.persistence.schema-generation.database.action"
- value="drop-and-create" />
- </properties>
- </persistence-unit>
+<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+ <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
+ <!-- Limited use for generating the DB and schema files for iatest DB - uses hibernate -->
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <class>org.onap.policy.common.ia.jpa.IaTestEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <property name="javax.persistence.schema-generation.database.action" value="create" />
+ <property name="hibernate.show_sql" value="false" />
+ </properties>
+ </persistence-unit>
- <persistence-unit name="integrityAuditPU"
- transaction-type="RESOURCE_LOCAL">
- <!-- For operational use -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <!-- none -->
- </properties>
- </persistence-unit>
+ <persistence-unit name="integrityAuditPU" transaction-type="RESOURCE_LOCAL">
+ <!-- For operational use -->
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ </properties>
+ </persistence-unit>
</persistence>
diff --git a/integrity-monitor/pom.xml b/integrity-monitor/pom.xml
index 72762ef5..5657d4b0 100644
--- a/integrity-monitor/pom.xml
+++ b/integrity-monitor/pom.xml
@@ -57,8 +57,12 @@
<artifactId>h2</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
index d4454db3..d0b320fc 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
@@ -3,6 +3,7 @@
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +48,6 @@ import javax.persistence.TypedQuery;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
-import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.common.im.jmx.ComponentAdmin;
import org.onap.policy.common.im.jmx.ComponentAdminMBean;
import org.onap.policy.common.im.jmx.JmxAgentConnection;
@@ -241,17 +241,7 @@ public class IntegrityMonitor {
//
// Create the entity manager factory
//
- if (!properties.containsKey(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML)) {
- properties.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceIM.xml");
- }
emf = Persistence.createEntityManagerFactory(getPersistenceUnit(), properties);
- //
- // Did it get created?
- //
- if (emf == null) {
- logger.error("Error creating IM entity manager factory with persistence unit: {}", getPersistenceUnit());
- throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory");
- }
// add entry to forward progress and resource registration tables in DB
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
index 13595028..f4c3f4f0 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
@@ -3,6 +3,7 @@
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@@ -35,9 +37,10 @@ import lombok.Setter;
@Entity
@Table(name = "ForwardProgressEntity")
-@NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e ")
-@NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")
-// @SequenceGenerator(name="seqForwardProgress", initialValue=1, allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e "),
+ @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")
+})
@Getter
@Setter
@NoArgsConstructor
@@ -45,7 +48,6 @@ public class ForwardProgressEntity extends DateEntity {
private static final long serialVersionUID = 1L;
@Id
- // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqForwardProgress")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "forwardProgressId")
@Setter(AccessLevel.NONE)
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
index 2b7b3d74..96a23908 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
@@ -3,6 +3,7 @@
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
@@ -41,9 +43,11 @@ import org.onap.policy.common.im.MonitorTime;
@Entity
@Table(name = "ImTestEntity")
-@NamedQuery(name = " ImTestEntity.findAll", query = "SELECT e FROM ImTestEntity e ")
-@NamedQuery(name = "ImTestEntity.deleteAll", query = "DELETE FROM ImTestEntity WHERE 1=1")
-// @SequenceGenerator(name="seqImTest", initialValue=1, allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = " ImTestEntity.findAll", query = "SELECT e FROM ImTestEntity e "),
+ @NamedQuery(name = "ImTestEntity.deleteAll", query = "DELETE FROM ImTestEntity WHERE 1=1")
+})
+
@Getter
@Setter
@NoArgsConstructor
@@ -51,7 +55,6 @@ public class ImTestEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqImTest")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ImTestId")
@Setter(AccessLevel.NONE)
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
index a8726f0f..7457f733 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
@@ -3,6 +3,7 @@
* Integrity Monitor
* ================================================================================
* Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import lombok.AccessLevel;
@@ -37,9 +39,12 @@ import lombok.Setter;
@Entity
@Table(name = "ResourceRegistrationEntity")
-@NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e ")
-@NamedQuery(name = "ResourceRegistrationEntity.deleteAll", query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")
-// @SequenceGenerator(name="seqResourceRegistration", initialValue=1, allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e "),
+ @NamedQuery(
+ name = "ResourceRegistrationEntity.deleteAll",
+ query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")
+})
@Getter
@Setter
@NoArgsConstructor
@@ -47,7 +52,6 @@ public class ResourceRegistrationEntity extends DateEntity {
private static final long serialVersionUID = 1L;
@Id
- // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqResourceRegistration")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ResourceRegistrationId")
@Setter(AccessLevel.NONE)
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
index c04a1b3a..44c4e9b7 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
@@ -42,7 +42,6 @@ import org.onap.policy.common.im.MonitorTime;
@Entity
@Table(name = "StateManagementEntity")
@NamedQuery(name = "StateManagementEntity.findAll", query = "SELECT e FROM StateManagementEntity e")
-// @SequenceGenerator(name="seqSM", initialValue=1, allocationSize=1)
@Getter
@Setter
@@ -51,7 +50,6 @@ public class StateManagementEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqSM")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
@Getter(AccessLevel.NONE)
diff --git a/integrity-monitor/src/main/resources/META-INF/persistenceIM.xml b/integrity-monitor/src/main/resources/META-INF/persistence.xml
index 7aff9219..f0c43a1e 100644
--- a/integrity-monitor/src/main/resources/META-INF/persistenceIM.xml
+++ b/integrity-monitor/src/main/resources/META-INF/persistence.xml
@@ -4,6 +4,7 @@
Integrity Monitor
================================================================================
Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -19,11 +20,11 @@
============LICENSE_END=========================================================
-->
-<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="schemaPU" transaction-type="RESOURCE_LOCAL">
- <!-- Limited use for generating the DB and schema files for imtest DB - uses eclipselink -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <!-- Limited use for generating the DB and schema files for imtest DB - uses hibernate -->
<class>org.onap.policy.common.im.jpa.ImTestEntity</class>
<class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
<class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
@@ -36,7 +37,6 @@
<persistence-unit name="operationalPU" transaction-type="RESOURCE_LOCAL">
<!-- For operational use -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.onap.policy.common.im.jpa.ImTestEntity</class>
<class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
<class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
index ffa45a25..684ac749 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
@@ -31,7 +31,6 @@ import java.util.concurrent.TimeUnit;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.common.utils.jpa.EntityTransCloser;
import org.onap.policy.common.utils.test.log.logback.ExtractAppender;
import org.onap.policy.common.utils.time.CurrentTime;
@@ -165,7 +164,6 @@ public class IntegrityMonitorTestBase {
properties.put(IntegrityMonitorProperties.NODE_TYPE, NODE_TYPE);
properties.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
String.valueOf(REFRESH_INTERVAL_MS));
- properties.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceIM.xml");
emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT, makeProperties());
diff --git a/utils/pom.xml b/utils/pom.xml
index 5fdd4b33..c4d79b60 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -83,8 +83,8 @@
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>eclipselink</artifactId>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.1-api</artifactId>
</dependency>
<dependency>
<groupId>com.worldturner.medeia</groupId>