From 20da3d02c6c5507761c257b6ec6f58dcfc27d05a Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Fri, 15 Jun 2018 08:28:00 +0200 Subject: 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 --- .../be/components/impl/CassandraHealthCheck.java | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'catalog-be/src/main') 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; -- cgit 1.2.3-korg