summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-10-17 20:58:39 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-17 20:58:39 +0000
commit2a5af723adf9c71d919d701313e7809f8160ef3a (patch)
tree6977ed66762071663ab5f00123ad65c51b4ed5e2 /controlloop/common/eventmanager/src/main
parent2acb0748a0fff2fa89b6c1d7dbe4d4935b2823a3 (diff)
parentb715f669284012b1d25c183e73b550c4648abd1a (diff)
Merge "Fix operation history DB properties for Junits"
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java14
-rw-r--r--controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml3
2 files changed, 10 insertions, 7 deletions
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 4f879b67b..608d2c00d 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
@@ -47,6 +47,7 @@ import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.so.SOResponse;
import org.onap.policy.vfc.VFCResponse;
+import org.onap.policy.guard.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -555,12 +556,15 @@ public class ControlLoopOperationManager implements Serializable {
// DB Properties
Properties props = new Properties();
- try (InputStream is = org.onap.policy.guard.PIPEngineGetHistory.class.getResourceAsStream(org.onap.policy.guard.PIPEngineGetHistory.OPS_HIST_PROPS_LOC)){
- props.load(is);
- } catch (Exception ex) {
- logger.error("getCountFromDB threw: ", ex);
- return;
+ if(PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_URL) != null &&
+ PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_USER) != null &&
+ PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_PASS) != null){
+ props.put(Util.ECLIPSE_LINK_KEY_URL, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_URL));
+ props.put(Util.ECLIPSE_LINK_KEY_USER, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_USER));
+ props.put(Util.ECLIPSE_LINK_KEY_PASS, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_PASS));
}
+
+
String OpsHistPU = System.getProperty("OperationsHistoryPU");
if(OpsHistPU == null || !OpsHistPU.equals("TestOperationsHistoryPU")){
OpsHistPU = "OperationsHistoryPU";
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 827e2562b..9af545592 100644
--- a/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
+++ b/controlloop/common/eventmanager/src/main/resources/META-INF/persistence.xml
@@ -9,10 +9,9 @@
<!-- <jar-file>packedEntity.jar</jar-file> -->
<class>org.onap.policy.controlloop.eventmanager.OperationsHistoryDbEntry</class>
<properties>
- <property name="eclipselink.ddl-generation" value="create-tables" />
+ <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
<property name="eclipselink.logging.level" value="WARNING" />
- <!-- Credential and URL properties located in /guard/src/main/resources/operation_history.properties -->
</properties>
</persistence-unit>
</persistence>