From 4654da998f4cd9390e2e1a02f4aa2bdf198893c0 Mon Sep 17 00:00:00 2001 From: "k.kedron" Date: Fri, 13 Mar 2020 17:15:14 +0100 Subject: Remove hardcoded timeout Added configuration for wait seconds for Cassandra connector. Also, increase the timeout value to prevent tests failed. Issue-ID: SDC-2759 Signed-off-by: Krystian Kedron Change-Id: I1008ecce98efdd8627ac3232b35fecd2a41a9c79 --- .../be/dao/cassandra/schema/SdcSchemaUtils.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'catalog-dao/src/main/java') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java index 3d68980d73..76532f6ed8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ProtocolVersion; import com.datastax.driver.core.Session; import com.datastax.driver.core.SocketOptions; import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; @@ -51,7 +50,7 @@ public class SdcSchemaUtils { cluster = createCluster(); isConnected = true; } catch (Exception e) { - log.info("** CassandraClient isn't connected. error is {}", e); + log.info("** CassandraClient isn't connected. error is", e); } log.info("** cluster created"); @@ -70,25 +69,26 @@ public class SdcSchemaUtils { List nodes = config.getCassandraHosts(); Integer cassandraPort = config.getCassandraPort(); if (nodes == null || cassandraPort == null) { - log.info("no nodes or port were supplied in configuration."); + log.info("No nodes or port were supplied in configuration."); return null; } - log.info("connecting to node:{} port{}.", nodes, cassandraPort); + log.info("Connecting to node: {} port: {}.", nodes, cassandraPort); Cluster.Builder clusterBuilder = Cluster.builder(); nodes.forEach(node -> clusterBuilder.addContactPoint(node).withPort(cassandraPort)); - clusterBuilder.withMaxSchemaAgreementWaitSeconds(60); - - setSocketOptions(clusterBuilder, config); - if(!enableAuthentication(clusterBuilder, config)){ + log.info("Connection timeout in seconds : {}", config.getMaxWaitSeconds()); + clusterBuilder.withMaxSchemaAgreementWaitSeconds(config.getMaxWaitSeconds()); + + setSocketOptions(clusterBuilder, config); + if (!enableAuthentication(clusterBuilder, config)) { return null; } - - if(!enableSsl(clusterBuilder, config)){ + + if (!enableSsl(clusterBuilder, config)) { return null; } setLocalDc(clusterBuilder, config); - + return clusterBuilder.build(); } -- cgit 1.2.3-korg