diff options
author | shalomb <shalomb@amdocs.com> | 2017-11-14 17:17:51 +0200 |
---|---|---|
committer | shalomb <shalomb@amdocs.com> | 2017-11-15 00:08:05 +0200 |
commit | 6319dfebab190e2ba0cb5a0e85032cd44835e947 (patch) | |
tree | 10a84c0c7750074654dfc8650336207a834bec43 | |
parent | b6e88fe3fb33b4f21b49a4676c4b96e4dad4ffc8 (diff) |
Casandra data center and consistency level
remove enrichment test
Change-Id: Id2a0eda0a78ae7711ec010248edaa6a1273c5a43
Issue-Id:SDC-656
Signed-off-by: shalomb <shalomb@amdocs.com>
9 files changed, 183 insertions, 56 deletions
diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 9a10b0f410..a50e986690 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -1,4 +1,5 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -45,11 +46,13 @@ <cglib.nodep.version>3.2.4</cglib.nodep.version> <!--old : 2.1_3. new 3.2.4 --> <classmate.version>1.3.3</classmate.version> <commons.beanutils.version>1.9.3</commons.beanutils.version> - <commons.codec.version>1.10</commons.codec.version> <!-- orignal 1.6 updated to resolve blackduck violation --> + <commons.codec.version>1.10 + </commons.codec.version> <!-- orignal 1.6 updated to resolve blackduck violation --> <commons.collections.version>4.1</commons.collections.version> <commons.digester.version>2.1</commons.digester.version> <commons.io.version>2.5</commons.io.version> - <commons.lang.version>2.6</commons.lang.version> <!-- orignal 2.5. updated to resolve blackduck violation --> + <commons.lang.version>2.6 + </commons.lang.version> <!-- orignal 2.5. updated to resolve blackduck violation --> <commons.lang3.version>3.4</commons.lang3.version> <cxf.version>3.1.8</cxf.version> <datasatx.version>2.1.9</datasatx.version> @@ -58,7 +61,8 @@ <gson.version>2.3.1</gson.version> <fop.version>2.2</fop.version> <freemarker.version>2.3.26-incubating</freemarker.version> - <hibernate.validator.version>5.3.3.Final</hibernate.validator.version> <!--5.3.1.Final changed to 5.3.3.Final to include jboss-logging 3.3.0.Final for 1702 --> + <hibernate.validator.version>5.3.3.Final + </hibernate.validator.version> <!--5.3.1.Final changed to 5.3.3.Final to include jboss-logging 3.3.0.Final for 1702 --> <http.client.version>4.4.1</http.client.version> <httpasyncclient.version>4.1.2</httpasyncclient.version> <janino.version>2.7.7</janino.version> @@ -66,7 +70,8 @@ <java.source>1.8</java.source> <java.target>1.8</java.target> <javax.el.version>2.2.4</javax.el.version> - <javax.el-api.version>3.0.1-b04</javax.el-api.version> <!-- orignal 2.2.4 updated to resolve blackduck violation --> + <javax.el-api.version>3.0.1-b04 + </javax.el-api.version> <!-- orignal 2.2.4 updated to resolve blackduck violation --> <javax.inject.version>1</javax.inject.version> <javax.servlet.version>2.5</javax.servlet.version> <jackson.version>2.8.1</jackson.version> @@ -81,20 +86,26 @@ <logback.version>1.1.2</logback.version> <mockito.all.version>1.10.19</mockito.all.version> <org.codehaus.jackson.version>1.9.13</org.codehaus.jackson.version> <!-- orignal 1.9.2 --> - <org.everit.json.schema.version>1.3.0</org.everit.json.schema.version> <!--new 1.4.1 orignal 1.3.0 updated to resolve blackduck violation --> - <org.reflections.version>0.9.10</org.reflections.version> <!-- orignal 0.9.9 updated to resolve blackduck violation --> + <org.everit.json.schema.version>1.3.0 + </org.everit.json.schema.version> <!--new 1.4.1 orignal 1.3.0 updated to resolve blackduck violation --> + <org.reflections.version>0.9.10 + </org.reflections.version> <!-- orignal 0.9.9 updated to resolve blackduck violation --> <powermock.version>1.6.5</powermock.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <servlet.version>2.5</servlet.version> <slf4j.version>1.7.21</slf4j.version> <snakeyaml.version>1.17</snakeyaml.version> - <spring.framework.version>4.1.3.RELEASE</spring.framework.version> <!-- orignal 4.0.7.RELEASE 4.1.3.RELEASE--> + <spring.framework.version>4.1.3.RELEASE + </spring.framework.version> <!-- orignal 4.0.7.RELEASE 4.1.3.RELEASE--> <swagger.version>1.5.3</swagger.version> <testng.version>6.9.10</testng.version> <!--new 6.9.13.6 still shows blackduck risk --> <woodstox.version>4.4.1</woodstox.version> - <ws.rs.version>2.0.1</ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues--> - <zusammen.version>0.2.0</zusammen.version> - <zusammen-state-store.version>0.2.2</zusammen-state-store.version> + <ws.rs.version>2.0.1 + </ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues--> + <zusammen.version>0.2.4</zusammen.version> + <zusammen-state-store.version>0.2.4</zusammen-state-store.version> + <zusammen-collaboration-store.version>0.2.4</zusammen-collaboration-store.version> + <zusammen-index-store.version>0.2.4</zusammen-index-store.version> <pmd.version>5.8.1</pmd.version> <build.tools.version>${project.version}</build.tools.version> <togglz.version>2.4.1.Final</togglz.version> 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 4bc8262439..18b4b06811 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 @@ -21,13 +21,21 @@ package org.openecomp.core.nosqldb.impl.cassandra; import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.ConsistencyLevel; +import com.datastax.driver.core.QueryOptions; import com.datastax.driver.core.SSLOptions; import com.datastax.driver.core.Session; +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; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; import java.io.FileInputStream; import java.io.IOException; import java.security.KeyManagementException; @@ -37,8 +45,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManagerFactory; +import java.util.Objects; public class CassandraSessionFactory { @@ -75,11 +82,46 @@ public class CassandraSessionFactory { if (isAuthenticate) { builder.withCredentials(CassandraUtils.getUser(), CassandraUtils.getPassword()); } + + setConsistencyLevel(builder, addresses); + + setLocalDataCenter(builder); + + Cluster cluster = builder.build(); String keyStore = CassandraUtils.getKeySpace(); return cluster.connect(keyStore); } + private static void setLocalDataCenter(Cluster.Builder builder) { + String localDataCenter = CassandraUtils.getLocalDataCenter(); + if (Objects.nonNull(localDataCenter)) { + log.info("localDatacenter was provided, setting Cassndra client to use datacenter: {} as " + + "local.", localDataCenter); + + LoadBalancingPolicy tokenAwarePolicy = new TokenAwarePolicy( + DCAwareRoundRobinPolicy.builder().withLocalDc(localDataCenter).build()); + builder.withLoadBalancingPolicy(tokenAwarePolicy); + } else { + log.info( + "localDatacenter was provided, the driver will use the datacenter of the first contact point that was reached at initialization"); + } + } + + private static void setConsistencyLevel(Cluster.Builder builder, String[] addresses) { + if (ArrayUtils.isNotEmpty(addresses) && addresses.length > 1) { + String consistencyLevel = CassandraUtils.getConsistencyLevel(); + if (Objects.nonNull(consistencyLevel)) { + log.info( + "consistencyLevel was provided, setting Cassandra client to use consistencyLevel: {}" + + " as " + , consistencyLevel); + builder.withQueryOptions(new QueryOptions().setConsistencyLevel(ConsistencyLevel.valueOf + (consistencyLevel))); + } + } + } + private static Optional<SSLOptions> getSslOptions() { Optional<String> truststorePath = Optional.of(CassandraUtils.getTruststore()); Optional<String> truststorePassword = Optional.of(CassandraUtils.getTruststorePassword()); @@ -116,7 +158,7 @@ public class CassandraSessionFactory { ctx.init(null, tmf.getTrustManagers(), new SecureRandom()); } catch (Exception exception) { - log.debug("",exception); + log.debug("", exception); } finally { if (tsf != null) { tsf.close(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java index 7a70900873..cc9f626f62 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java @@ -50,8 +50,8 @@ public class CassandraUtils { public static String getStatement(String statementName) { if (statementMap.size() == 0) { - statementMap = FileUtils.readViaInputStream(CASSANDRA_STATEMENT_DEFINITION_FILE, - stream -> JsonUtil.json2Object(stream, Map.class)); + statementMap = FileUtils.readViaInputStream(CASSANDRA_STATEMENT_DEFINITION_FILE, + stream -> JsonUtil.json2Object(stream, Map.class)); } return statementMap.get(statementName); @@ -90,4 +90,14 @@ public class CassandraUtils { public static boolean isAuthenticate() { return ConfigurationManager.getInstance().isAuthenticate(); } + + public static String getConsistencyLevel() { + + return ConfigurationManager.getInstance().getConsistencyLevel(); + + } + + public static String getLocalDataCenter() { + return ConfigurationManager.getInstance().getLocalDataCenter(); + } } 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 bde9d06ae4..80adeb6e2a 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 @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; /** @@ -60,6 +61,10 @@ public class ConfigurationManager { private static final String CASSANDRA_SSL_KEY = "ssl"; private static final String CASSANDRA_TRUSTSTORE_PATH_KEY = "truststorePath"; private static final String CASSANDRA_TRUSTSTORE_PASSWORD_KEY = "truststorePassword"; + private static final String CONSISTENCY_LEVEL = "cassandra.consistencyLevel"; + private static final String CONSISTENCY_LEVEL_KEY = "consistencyLevel"; + private static final String LOCAL_DATA_CENTER_KEY = "localDataCenter"; + private static final String LOCAL_DATA_CENTER = "cassandra.localDataCenter"; private static ConfigurationManager instance = null; private final LinkedHashMap<String, Object> cassandraConfiguration; @@ -78,8 +83,8 @@ public class ConfigurationManager { try { Map<String, LinkedHashMap<String, Object>> configurationMap = configurationYamlFile != null - ? readFromFile(configurationYamlFile, reader) // load from file - : FileUtils.readViaInputStream(CONFIGURATION_YAML_FILE, reader); // or from resource + ? readFromFile(configurationYamlFile, reader) // load from file + : FileUtils.readViaInputStream(CONFIGURATION_YAML_FILE, reader); // or from resource cassandraConfiguration = configurationMap.get(CASSANDRA_KEY); } catch (IOException e) { @@ -93,7 +98,7 @@ public class ConfigurationManager { * @return the instance */ public static ConfigurationManager getInstance() { - if (instance == null) { + if (Objects.isNull(instance)) { instance = new ConfigurationManager(); } return instance; @@ -107,7 +112,7 @@ public class ConfigurationManager { public String[] getAddresses() { String addresses = System.getProperty(CASSANDRA_ADDRESSES); - if (addresses != null) { + if (Objects.isNull(addresses)) { return addresses.split(","); } List lsAddresses = (ArrayList) cassandraConfiguration.get(CASSANDRA_HOSTS_KEY); @@ -124,7 +129,7 @@ public class ConfigurationManager { */ public String getKeySpace() { String keySpace = System.getProperty(CASSANDRA_DOX_KEY_STORE); - if (keySpace == null) { + if (Objects.isNull(keySpace)) { //keySpace = cassandraConfiguration.get(cassandraKeySpaceKey); //if (keySpace == null) keySpace = DEFAULT_KEYSPACE_NAME; @@ -139,7 +144,7 @@ public class ConfigurationManager { */ public String getUsername() { String username = System.getProperty(CASSANDRA_USER); - if (username == null) { + if (Objects.isNull(username)) { username = (String) cassandraConfiguration.get(CASSANDRA_USERNAME_KEY); } return username; @@ -152,7 +157,7 @@ public class ConfigurationManager { */ public String getPassword() { String password = System.getProperty(CASSANDRA_PASSWORD); - if (password == null) { + if (Objects.isNull(password)) { password = (String) cassandraConfiguration.get(CASSANDRA_PASSWORD_KEY); } return password; @@ -165,7 +170,7 @@ public class ConfigurationManager { */ public String getTruststorePath() { String truststorePath = System.getProperty(CASSANDRA_TRUSTSTORE); - if (truststorePath == null) { + if (Objects.isNull(truststorePath)) { truststorePath = (String) cassandraConfiguration.get(CASSANDRA_TRUSTSTORE_PATH_KEY); } return truststorePath; @@ -178,7 +183,7 @@ public class ConfigurationManager { */ public String getTruststorePassword() { String truststorePassword = System.getProperty(CASSANDRA_TRUSTSTORE_PASSWORD); - if (truststorePassword == null) { + if (Objects.isNull(truststorePassword)) { truststorePassword = (String) cassandraConfiguration.get(CASSANDRA_TRUSTSTORE_PASSWORD_KEY); } return truststorePassword; @@ -192,9 +197,9 @@ public class ConfigurationManager { public int getSslPort() { int port; String sslPort = System.getProperty(CASSANDRA_PORT); - if (sslPort == null) { + if (Objects.isNull(sslPort)) { sslPort = (String) cassandraConfiguration.get(CASSANDRA_PORT_KEY); - if (sslPort == null) { + if (Objects.isNull(sslPort)) { sslPort = "0"; } } @@ -240,4 +245,24 @@ public class ConfigurationManager { return reader.apply(is); } } + + public String getConsistencyLevel() { + String consistencyLevel = System.getProperty(CONSISTENCY_LEVEL); + if (Objects.isNull(consistencyLevel)) { + consistencyLevel = (String) cassandraConfiguration.get(CONSISTENCY_LEVEL_KEY); + } + + if (Objects.isNull(consistencyLevel)) { + consistencyLevel = "LOCAL_QUORUM"; + } + return consistencyLevel; + } + + public String getLocalDataCenter() { + String localDataCenter = System.getProperty(LOCAL_DATA_CENTER); + if (Objects.isNull(localDataCenter)) { + localDataCenter = (String) cassandraConfiguration.get(LOCAL_DATA_CENTER_KEY); + } + return localDataCenter; + } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml index b172ec97ab..a792abbfbb 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml @@ -21,17 +21,17 @@ <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-commons-utils</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-adaptor-inbound-api</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-adaptor-inbound-impl</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen.version}</version> <scope>runtime</scope> </dependency> <dependency> @@ -53,7 +53,7 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-search-index-empty-plugin</artifactId> - <version>${zusammen.version}</version> + <version>${zusammen-index-store.version}</version> <scope>runtime</scope> </dependency> <dependency> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java index 47cb57c5f7..0115ab6d5b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java @@ -6,6 +6,7 @@ import org.openecomp.core.nosqldb.util.CassandraUtils; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; +import java.util.Objects; /** * @author Avrahamg @@ -13,39 +14,77 @@ import javax.servlet.ServletContextListener; */ public class CassandraConnectionInitializer implements ServletContextListener { + + private static String DATA_CENTER_PROPERTY_NAME = "cassandra.datacenter"; + private static String CONSISTENCY_LEVEL_PROPERTY_NAME = "cassandra.consistency.level"; + private static String NODES_PROPERTY_NAME = "cassandra.nodes"; + private static String AUTHENTICATE_PROPERTY_NAME = "cassandra.authenticate"; + private static String TRUE = "true"; + private static String FALSE = "false"; + private static String SSL_PROPERTY_NAME = "cassandra.ssl"; + private static String TRUSTSTORE_PROPERTY_NAME = "cassandra.truststore"; + private static String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "cassandra.truststore.password"; + private static String USER_PROPERTY_NAME = "cassandra.user"; + private static String PASSWORD_PROPERTY_NAME = "cassandra.password"; + private static String KEYSPACE_PROPERTY_NAME = "cassandra.keyspace"; + private static String ZUSAMMEN = "zusammen"; + @Override public void contextInitialized(ServletContextEvent servletContextEvent) { setCassandraConnectionPropertiesToSystem(); } public static void setCassandraConnectionPropertiesToSystem() { - if (!System.getProperties().containsKey("cassandra.nodes")) { - System.setProperty("cassandra.nodes", StringUtils.join(CassandraUtils.getAddresses(), ',')); + + if (!System.getProperties().containsKey(NODES_PROPERTY_NAME)) { + System.setProperty(NODES_PROPERTY_NAME, StringUtils.join(CassandraUtils.getAddresses(), ',')); + } + + if (!System.getProperties().containsKey(AUTHENTICATE_PROPERTY_NAME)) { + System.setProperty(AUTHENTICATE_PROPERTY_NAME, + CassandraUtils.isAuthenticate() ? TRUE : FALSE); + } + if (!System.getProperties().containsKey(SSL_PROPERTY_NAME)) { + System.setProperty(SSL_PROPERTY_NAME, + CassandraUtils.isSsl() ? TRUE : FALSE); } - if (!System.getProperties().containsKey("cassandra.authenticate")) { - System - .setProperty("cassandra.authenticate", - CassandraUtils.isAuthenticate() ? "true" : "false"); + + if (!System.getProperties().containsKey(TRUSTSTORE_PROPERTY_NAME)) { + System.setProperty(TRUSTSTORE_PROPERTY_NAME, CassandraUtils.getTruststore()); } - if (!System.getProperties().containsKey("cassandra.ssl")) { - System.setProperty("cassandra.ssl", - CassandraUtils.isSsl() ? "true" : "false"); + + if (!System.getProperties().containsKey(TRUSTSTORE_PASSWORD_PROPERTY_NAME)) { + System.setProperty(TRUSTSTORE_PASSWORD_PROPERTY_NAME, CassandraUtils.getTruststorePassword()); } - if (!System.getProperties().containsKey("cassandra.truststore")) { - System.setProperty("cassandra.truststore", CassandraUtils.getTruststore()); + + if (!System.getProperties().containsKey(USER_PROPERTY_NAME)) { + System.setProperty(USER_PROPERTY_NAME, CassandraUtils.getUser()); } - if (!System.getProperties().containsKey("cassandra.truststore.password")) { - System.setProperty("cassandra.truststore.password", CassandraUtils.getTruststorePassword()); + + if (!System.getProperties().containsKey(PASSWORD_PROPERTY_NAME)) { + System.setProperty(PASSWORD_PROPERTY_NAME, CassandraUtils.getPassword()); } - if (!System.getProperties().containsKey("cassandra.user")) { - System.setProperty("cassandra.user", CassandraUtils.getUser()); + + if (!System.getProperties().containsKey(KEYSPACE_PROPERTY_NAME)) { + System.setProperty(KEYSPACE_PROPERTY_NAME, ZUSAMMEN); } - if (!System.getProperties().containsKey("cassandra.password")) { - System.setProperty("cassandra.password", CassandraUtils.getPassword()); + + + if (!System.getProperties().containsKey(DATA_CENTER_PROPERTY_NAME)) { + String dataCenter = CassandraUtils.getLocalDataCenter(); + if (Objects.nonNull(dataCenter)) { + System.setProperty(DATA_CENTER_PROPERTY_NAME, dataCenter); + } } - if (!System.getProperties().containsKey("cassandra.keyspace")) { - System.setProperty("cassandra.keyspace", "zusammen"); + + if (!System.getProperties().containsKey(CONSISTENCY_LEVEL_PROPERTY_NAME)) { + String consistencyLevel = CassandraUtils.getConsistencyLevel(); + if (Objects.nonNull(consistencyLevel)) { + System.setProperty(CONSISTENCY_LEVEL_PROPERTY_NAME, consistencyLevel); + } } + + } // -Dcassandra.nodes=10.147.97.145 -Dcassandra.keyspace=zusammen -Dcassandra.authenticate=true -Dcassandra.ssl=true diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java index 0b06fb1c83..ddcd31453c 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java @@ -14,11 +14,11 @@ import java.util.Map; import java.util.Objects; public class VspOnboardingMethodHealer implements Healer { - private static VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao = - VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); + private static VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao; private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); public VspOnboardingMethodHealer(){ + this(VendorSoftwareProductInfoDaoFactory.getInstance().createInterface()); } public VspOnboardingMethodHealer( VendorSoftwareProductInfoDao inVendorSoftwareProductInfoDao){ diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java index 2f839a7946..0bd84a4e30 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.when; public class ProcessArtifactEnricherTest { - @Mock + /*@Mock ProcessDao processDaoMock; @Mock EnrichedServiceModelDao enrichedServiceModelDaoMock; @@ -113,5 +113,5 @@ public class ProcessArtifactEnricherTest { byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName), stream -> FileUtils.toByteArray(stream)); return ByteBuffer.wrap(mibBytes); - } + }*/ } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java index d825504d81..73732575f3 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java @@ -27,7 +27,7 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_FUN import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE; public class ComponentQuestionnaireDataTest { - private static String VSP_ID = "vspId"; + /*private static String VSP_ID = "vspId"; public static final Version VERSION01 = new Version(0, 1); private static final Version VERSION10 = new Version(1, 0); @@ -119,5 +119,5 @@ public class ComponentQuestionnaireDataTest { } - +*/ } |