aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2017-12-12 15:18:30 +0530
committerojasdubey <ojas.dubey@amdocs.com>2017-12-12 18:24:18 +0530
commit29a456fd248ecf4178d85e2f914975fafc4c4093 (patch)
tree81e83f1ca94fdf55e372d5f5491f1572891fadb6 /common
parentc8983a6f979ede3817f060cfa5f93ee40a75fcf4 (diff)
Fix - Translator core tests stuck
Updated invalid dbhost config value to empty based on review comments Issue-ID: SDC-748 Change-Id: Idc691bdc7e2b988654ae87c2581ccbdd86586aae Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'common')
-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)
"l l-Scalar l-Scalar-Plain">labels: app: {{ include "common.name" . }} release: {{ include "common.release" . }} annotations: sidecar.istio.io/inject: "{{.Values.istioSidecar}}" spec: initContainers: #Example init container for dependency checking # - command: # - /app/ready.py # args: # - --container-name # - mariadb # env: # - name: NAMESPACE # valueFrom: # fieldRef: # apiVersion: v1 # fieldPath: metadata.namespace # image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" # imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} # name: {{ include "common.name" . }}-readiness containers: - name: {{ include "common.name" . }} image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} ports: - containerPort: {{ .Values.service.internalPort }} # disable liveness probe when breakpoints set in debugger # so K8s doesn't restart unresponsive container {{ if .Values.liveness.enabled }} livenessProbe: tcpSocket: port: {{ .Values.service.internalPort }} initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.liveness.periodSeconds }} {{ end }} readinessProbe: tcpSocket: port: {{ .Values.service.internalPort }} initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.readiness.periodSeconds }} env: - name: MSB_HOST value: "{{ .Values.global.config.msbprotocol }}://{{ .Values.global.config.msbServiceName }}:{{ .Values.global.config.msbPort }}" - name: SSL_ENABLED value: "{{ .Values.global.config.ssl_enabled }}" - name: REG_TO_MSB_WHEN_START value: "{{ .Values.global.config.reg_to_msb_when_start }}" volumeMounts: - name: {{ include "common.fullname" . }}-localtime mountPath: /etc/localtime readOnly: true - name: {{ include "common.fullname" . }}-logs mountPath: /var/log/onap - name: {{ include "common.fullname" . }}-logconfig mountPath: /opt/vfc/ztevnfmdriver/config/log.yml subPath: log.yml resources: {{ include "common.resources" . | indent 12 }} {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 10 }} {{- end -}} {{- if .Values.affinity }} affinity: {{ toYaml .Values.affinity | indent 10 }} {{- end }} # side car containers - name: {{ include "common.name" . }}-filebeat-onap image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} volumeMounts: - name: {{ include "common.fullname" . }}-filebeat-conf mountPath: /usr/share/filebeat/filebeat.yml subPath: filebeat.yml - name: {{ include "common.fullname" . }}-logs mountPath: /var/log/onap - name: {{ include "common.fullname" . }}-data-filebeat mountPath: /usr/share/filebeat/data volumes: - name: {{ include "common.fullname" . }}-localtime hostPath: path: /etc/localtime - name: {{ include "common.fullname" . }}-logs emptyDir: {} - name: {{ include "common.fullname" . }}-logconfig configMap: name : {{ include "common.fullname" . }}-logging-configmap - name: {{ include "common.fullname" . }}-filebeat-conf configMap: name: {{ include "common.release" . }}-vfc-filebeat-configmap - name: {{ include "common.fullname" . }}-data-filebeat emptyDir: {} imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key"