diff options
Diffstat (limited to 'integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java')
-rw-r--r-- | integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java | 15 |
1 files changed, 7 insertions, 8 deletions
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 c034482f..1433c20d 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 @@ -3,6 +3,7 @@ * Integrity Audit * ================================================================================ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Modificaitons 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. @@ -22,22 +23,21 @@ package org.onap.policy.common.im; import static org.junit.Assert.assertTrue; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.Persistence; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import java.util.concurrent.Semaphore; 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; import org.onap.policy.common.utils.time.TestTime; -import org.powermock.reflect.Whitebox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.test.util.ReflectionTestUtils; /** * All JUnits are designed to run in the local development environment where they have write @@ -153,7 +153,7 @@ public class IntegrityMonitorTestBase { IntegrityMonitor.setUnitTesting(true); testTime = new TestTime(); - Whitebox.setInternalState(MonitorTime.class, TIME_INSTANCE_FIELD, testTime); + ReflectionTestUtils.setField(MonitorTime.class, TIME_INSTANCE_FIELD, testTime); properties = new Properties(); properties.put(IntegrityMonitorProperties.DB_DRIVER, DB_DRIVER); @@ -164,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()); @@ -187,7 +186,7 @@ public class IntegrityMonitorTestBase { systemProps.put(JMX_PORT_PROP, savedJmxPort); } - Whitebox.setInternalState(MonitorTime.class, TIME_INSTANCE_FIELD, savedTime); + ReflectionTestUtils.setField(MonitorTime.class, TIME_INSTANCE_FIELD, savedTime); IntegrityMonitor.setUnitTesting(false); |