aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorPiotr Darosz <piotr.darosz@nokia.com>2018-06-15 08:28:00 +0200
committerTal Gitelman <tg851x@intl.att.com>2018-08-29 13:27:45 +0000
commit20da3d02c6c5507761c257b6ec6f58dcfc27d05a (patch)
tree6fef3ccd72cb8c092adac410b77a5da25284055a /catalog-be/src
parent8eff5a1ff79ca212a42d0e69326af7dc00b7c503 (diff)
Add tests for SdcSchema classes
Introduce Cassandra Unit tool and tests for schema-related classes Change-Id: I14da602c42056730e7992dd92b4da8b87dd9fb0d Issue-ID: SDC-1358 Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java30
-rw-r--r--catalog-be/src/test/resources/paths/path-context.xml22
2 files changed, 49 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
index 05a0eb52ef..bc5f77ba1b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2018 Nokia
+ * ================================================================================
+ */
package org.openecomp.sdc.be.components.impl;
import com.datastax.driver.core.Cluster;
@@ -12,6 +33,7 @@ import org.openecomp.sdc.common.util.GeneralUtility;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
+
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.*;
@@ -28,6 +50,8 @@ public class CassandraHealthCheck {
private int HC_FormulaNumber;
+ private SdcSchemaUtils sdcSchemaUtils;
+
@PostConstruct
private void init() {
@@ -61,14 +85,14 @@ public class CassandraHealthCheck {
}
log.info("All sdc keyspaces are : {}", sdcKeyspaces);
-
+ sdcSchemaUtils = new SdcSchemaUtils();
//Calculate the Formula of Health Check
Cluster cluster = null;
try {
log.info("creating cluster for Cassandra Health Check.");
//Create cluster from nodes in cassandra configuration
- cluster = SdcSchemaUtils.createCluster();
+ cluster = sdcSchemaUtils.createCluster();
if (cluster == null) {
log.error("Failure create cassandra cluster.");
return;
@@ -141,7 +165,7 @@ public class CassandraHealthCheck {
Session session = null;
try {
log.info("creating cluster for Cassandra for monitoring.");
- cluster = SdcSchemaUtils.createCluster();
+ cluster = sdcSchemaUtils.createCluster();
if (cluster == null) {
log.error("Failure create cassandra cluster.");
return false;
diff --git a/catalog-be/src/test/resources/paths/path-context.xml b/catalog-be/src/test/resources/paths/path-context.xml
index e1e3997463..b9415bfbfa 100644
--- a/catalog-be/src/test/resources/paths/path-context.xml
+++ b/catalog-be/src/test/resources/paths/path-context.xml
@@ -1,4 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============LICENSE_START=======================================================
+SDC
+================================================================================
+Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ *
+ http://www.apache.org/licenses/LICENSE-2.0
+ *
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END=========================================================
+Modifications copyright (c) 2018 Nokia
+================================================================================
+-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
@@ -70,6 +91,7 @@
<bean id="distributionEngine" class="org.openecomp.sdc.be.components.path.beans.DistributionEngineMock"/>
<bean id="forwardingPathValidator" class="org.openecomp.sdc.be.components.path.beans.ForwardingPathValidatorMock" />
<bean id="dataTypeValidatorConverter" class="org.openecomp.sdc.be.model.tosca.validators.DataTypeValidatorConverter" />
+ <bean id="sdcSchemaUtils" class="org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils" />
<util:properties id="elasticsearchConfig" location="paths/elasticsearch.yml" />
</beans>