aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib
diff options
context:
space:
mode:
authorshalomb <shalomb@amdocs.com>2017-11-15 12:04:52 +0200
committershalomb <shalomb@amdocs.com>2017-11-15 12:04:52 +0200
commit6a0ab8cbf809e6f0467c65c1916e7b03112a5e3e (patch)
treee2419873d67507fb907ef57f6d9e12a6a73872ef /openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib
parent185587ea94f38ea729a0416ba029297ecb8da324 (diff)
Casandra data center and consistency level
fix null check Change-Id: Ie31c76165329c078bce000ec25795492bb3b23f8 Issue-Id:SDC-656 Signed-off-by: shalomb <shalomb@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib')
-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;