aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authorVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-11-15 10:35:29 +0000
committerGerrit Code Review <gerrit@onap.org>2017-11-15 10:35:29 +0000
commitd52194fd5b45b5af0e0a9698b456f9945522bd80 (patch)
tree64f3a63cb4f68d5ad1d39df4e6670985e8c7e446 /openecomp-be
parent552ef55138ec653fed1d25ac6b9e3ff4bc284db9 (diff)
parent6a0ab8cbf809e6f0467c65c1916e7b03112a5e3e (diff)
Merge "Casandra data center and consistency level"
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java3
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java6
2 files changed, 5 insertions, 4 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
index 18b4b06811..519d7b160b 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
@@ -29,7 +29,6 @@ import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
import com.datastax.driver.core.policies.LoadBalancingPolicy;
import com.datastax.driver.core.policies.TokenAwarePolicy;
import com.google.common.base.Optional;
-import org.apache.commons.lang.ArrayUtils;
import org.openecomp.core.nosqldb.util.CassandraUtils;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -109,7 +108,7 @@ public class CassandraSessionFactory {
}
private static void setConsistencyLevel(Cluster.Builder builder, String[] addresses) {
- if (ArrayUtils.isNotEmpty(addresses) && addresses.length > 1) {
+ if (addresses != null && addresses.length > 1) {
String consistencyLevel = CassandraUtils.getConsistencyLevel();
if (Objects.nonNull(consistencyLevel)) {
log.info(
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
index fd7c1043e8..5723a6fe61 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
@@ -20,6 +20,7 @@
package org.openecomp.core.nosqldb.util;
+import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -116,9 +117,10 @@ public class ConfigurationManager {
return addresses.split(",");
}
List lsAddresses = (ArrayList) cassandraConfiguration.get(CASSANDRA_HOSTS_KEY);
- if (Objects.isNull(addresses) || addresses.length() == 0) {
- throw new RuntimeException("Missing Cassandra hose.Cassandra host missing is mandatory.");
+ if (CollectionUtils.isEmpty(lsAddresses)) {
+ log.info("No Cassandra hosts are defined.");
}
+
String[] addressesArray;
addressesArray = (String[]) lsAddresses.toArray(new String[lsAddresses.size()]);
return addressesArray;