aboutsummaryrefslogtreecommitdiffstats
path: root/common/openecomp-common-configuration-management
diff options
context:
space:
mode:
Diffstat (limited to 'common/openecomp-common-configuration-management')
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java5
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java4
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties2
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties2
4 files changed, 11 insertions, 2 deletions
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java
index 889efea3da..26ab2fecc8 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/ConfigurationUtils.java
@@ -489,6 +489,11 @@ public class ConfigurationUtils {
*/
public static boolean executeDdlSql(String sql) throws Exception {
DataSource datasource = ConfigurationDataSource.lookup();
+ if (datasource == null) {
+ System.err.println("DB configuration not found. Configuration management will be using "
+ + "in-memory persistence.");
+ return false;
+ }
try (Connection con = datasource.getConnection(); Statement stmt = con.createStatement()) {
stmt.executeQuery(sql);
} catch (Exception exception) {
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java
index edbae2fa9c..0cfc96bc7f 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/ConfigurationDataSource.java
@@ -2,6 +2,7 @@ package org.openecomp.config.impl;
import org.apache.commons.configuration2.ImmutableConfiguration;
import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.commons.lang3.StringUtils;
import org.openecomp.config.ConfigurationUtils;
import org.openecomp.config.Constants;
@@ -52,6 +53,9 @@ public final class ConfigurationDataSource {
public static BasicDataSource initDataSource() throws Exception {
ImmutableConfiguration dbConfig = ConfigurationRepository.lookup()
.getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE);
+ if (StringUtils.isEmpty(dbConfig.getString("dbhost"))) {
+ return null;
+ }
BasicDataSource datasource = new BasicDataSource();
String driverClassName = dbConfig.getString("driverClassName");
String jdbcUrl = dbConfig.getString("jdbcURL");
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties
index 934f0fcf37..cfe91e6c7d 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/resources/config-system.properties
@@ -8,7 +8,7 @@ configKey=key
configValue=value
configNameColumn=name
configdb=dox
-dbhost=127.0.0.1
+dbhost=
dbport=9042
dbname=cassandra
createtablecql=create table if not exists ${configdb}.${config.Table} (name text\, key text\, value text\, PRIMARY KEY (name\, key)) with clustering order by (key asc)
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties
index 934f0fcf37..cfe91e6c7d 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/resources/config-system.properties
@@ -8,7 +8,7 @@ configKey=key
configValue=value
configNameColumn=name
configdb=dox
-dbhost=127.0.0.1
+dbhost=
dbport=9042
dbname=cassandra
createtablecql=create table if not exists ${configdb}.${config.Table} (name text\, key text\, value text\, PRIMARY KEY (name\, key)) with clustering order by (key asc)