summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-healthcheck-manager
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/backend/openecomp-sdc-healthcheck-manager
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-healthcheck-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java11
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java27
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java18
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java63
13 files changed, 91 insertions, 138 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java
index 947387b4a6..0f1351e9bb 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDao.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health;
public interface HealthCheckDao {
- boolean checkHealth() throws Exception;
- String getVersion();
+
+ boolean checkHealth() throws Exception;
+
+ String getVersion();
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java
index 387d24d07c..d76eee25ef 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckDaoFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,14 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
public abstract class HealthCheckDaoFactory extends AbstractComponentFactory<HealthCheckDao> {
- public static HealthCheckDaoFactory getInstance() {
- return AbstractFactory.getInstance(HealthCheckDaoFactory.class);
- }
+
+ public static HealthCheckDaoFactory getInstance() {
+ return AbstractFactory.getInstance(HealthCheckDaoFactory.class);
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
index 0575d06058..6a543cbcf5 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManager.java
@@ -17,13 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health;
-import org.openecomp.sdc.health.data.HealthInfo;
-
import java.util.Collection;
+import org.openecomp.sdc.health.data.HealthInfo;
public interface HealthCheckManager {
+
Collection<HealthInfo> checkHealth();
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
index c3766068b2..00c3001496 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/HealthCheckManagerFactory.java
@@ -22,8 +22,8 @@ package org.openecomp.sdc.health;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-
public abstract class HealthCheckManagerFactory extends AbstractComponentFactory<HealthCheckManager> {
+
public static HealthCheckManagerFactory getInstance() {
return AbstractFactory.getInstance(HealthCheckManagerFactory.class);
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java
index bd47422a20..e243e7e555 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckResult.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,14 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.data;
import java.util.Collection;
/**
- * {
- "sdcVersion": "1702.0.83.37.1",
+ * { "sdcVersion": "1702.0.83.37.1",
"componentsInfo": [
{
@@ -36,11 +34,11 @@ import java.util.Collection;
…..
]
}
-
*/
public class HealthCheckResult {
+
String sdcVersion;
- Collection<HealthInfo> componentsInfo;
+ Collection<HealthInfo> componentsInfo;
public HealthCheckResult() {
}
@@ -60,6 +58,4 @@ public class HealthCheckResult {
public void setComponentsInfo(Collection<HealthInfo> componentsInfo) {
this.componentsInfo = componentsInfo;
}
-
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java
index c5ef04477c..fccbe2a907 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthCheckStatus.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,32 +17,27 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.data;
-
public enum HealthCheckStatus {
- UP("UP"),
- DOWN("DOWN");
-
+ UP("UP"), DOWN("DOWN");
private String name;
HealthCheckStatus(String name) {
this.name = name;
}
-
- @Override
- public String toString() {
- return name;
- }
-
- public static final HealthCheckStatus toValue(String inVal){
- for (HealthCheckStatus val : values()){
- if (val.toString().equals(inVal)){
+ public static final HealthCheckStatus toValue(String inVal) {
+ for (HealthCheckStatus val : values()) {
+ if (val.toString().equals(inVal)) {
return val;
}
}
return null;
}
+
+ @Override
+ public String toString() {
+ return name;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java
index 3bb58fbaf3..bad6ebfb89 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/HealthInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.data;
/**
@@ -34,6 +33,7 @@ package org.openecomp.sdc.health.data;
}
*/
public class HealthInfo {
+
private MonitoredModules healthCheckComponent;
private HealthCheckStatus healthCheckStatus;
private String version;
@@ -83,11 +83,7 @@ public class HealthInfo {
@Override
public String toString() {
- return "HealthInfo{" +
- "healthCheckComponent='" + healthCheckComponent + '\'' +
- ", healthCheckStatus=" + healthCheckStatus +
- ", version='" + version + '\'' +
- ", description='" + description + '\'' +
- '}';
+ return "HealthInfo{" + "healthCheckComponent='" + healthCheckComponent + '\'' + ", healthCheckStatus=" + healthCheckStatus + ", version='"
+ + version + '\'' + ", description='" + description + '\'' + '}';
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
index b51d79095a..f990f64336 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,26 +17,16 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.data;
-
public enum MonitoredModules {
- BE("BE"), CAS("Cassandra"),
- ZU("Zusammen");
-
+ BE("BE"), CAS("Cassandra"), ZU("Zusammen");
private String name;
MonitoredModules(String name) {
this.name = name;
}
-
- @Override
- public String toString() {
- return name;
- }
-
public static final MonitoredModules toValue(String inVal) {
for (MonitoredModules val : values()) {
if (val.toString().equals(inVal)) {
@@ -45,4 +35,9 @@ public enum MonitoredModules {
}
return null;
}
+
+ @Override
+ public String toString() {
+ return name;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java
index 810dee5355..be2cd33b1f 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/SiteMode.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,25 +17,16 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.data;
-
public enum SiteMode {
Active("active"), NOT_ACTIVE("NotActive");
-
private String name;
SiteMode(String name) {
this.name = name;
}
-
- @Override
- public String toString() {
- return name;
- }
-
public static final SiteMode toValue(String inVal) {
for (SiteMode val : values()) {
if (val.toString().equals(inVal)) {
@@ -44,4 +35,9 @@ public enum SiteMode {
}
return null;
}
+
+ @Override
+ public String toString() {
+ return name;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java
index ec0931c90b..02291ed23c 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,20 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.impl;
-
import org.openecomp.sdc.health.HealthCheckDao;
import org.openecomp.sdc.health.HealthCheckDaoFactory;
-public class HealthCheckDaoFactoryImpl
- extends HealthCheckDaoFactory {
- private static final HealthCheckDao INSTANCE =
- new HealthCheckDaoImpl();
+public class HealthCheckDaoFactoryImpl extends HealthCheckDaoFactory {
+
+ private static final HealthCheckDao INSTANCE = new HealthCheckDaoImpl();
- @Override
- public HealthCheckDao createInterface() {
- return INSTANCE;
- }
+ @Override
+ public HealthCheckDao createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java
index f9b4215322..340af95849 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckDaoImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.health.impl;
-
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.exceptions.DriverException;
import com.datastax.driver.mapping.annotations.Accessor;
@@ -34,9 +32,7 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
public class HealthCheckDaoImpl implements HealthCheckDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
-
- private static final CheckHealthAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(CheckHealthAccessor.class);
+ private static final CheckHealthAccessor accessor = noSqlDb.getMappingManager().createAccessor(CheckHealthAccessor.class);
private static final Logger logger = LoggerFactory.getLogger(HealthCheckDaoImpl.class);
@Override
@@ -63,7 +59,5 @@ public class HealthCheckDaoImpl implements HealthCheckDao {
@Query("SELECT * FROM application_config LIMIT 1")
ResultSet checkHealth();
-
}
-
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
index e5d85a2641..a50e5b15c2 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerFactoryImpl.java
@@ -23,12 +23,15 @@ import org.openecomp.sdc.health.HealthCheckManager;
import org.openecomp.sdc.health.HealthCheckManagerFactory;
public class HealthCheckManagerFactoryImpl extends HealthCheckManagerFactory {
- private static final HealthCheckManager INSTANCE ;
+
+ private static final HealthCheckManager INSTANCE;
static {
- INSTANCE = new HealthCheckManagerImpl();
+ INSTANCE = new HealthCheckManagerImpl();
}
@Override
- public HealthCheckManager createInterface() {return INSTANCE;}
+ public HealthCheckManager createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java
index dba724565f..de4c79950e 100644
--- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/impl/HealthCheckManagerImpl.java
@@ -13,12 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.health.impl;
import com.amdocs.zusammen.commons.health.data.HealthInfo;
import com.amdocs.zusammen.commons.health.data.HealthStatus;
import com.amdocs.zusammen.datatypes.SessionContext;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.core.zusammen.api.ZusammenUtil;
@@ -30,16 +34,9 @@ import org.openecomp.sdc.health.data.MonitoredModules;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class HealthCheckManagerImpl implements HealthCheckManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckManagerImpl.class);
-
private HealthCheckDao healthCheckDao;
public HealthCheckManagerImpl() {
@@ -53,22 +50,19 @@ public class HealthCheckManagerImpl implements HealthCheckManager {
@Override
public Collection<org.openecomp.sdc.health.data.HealthInfo> checkHealth() {
org.openecomp.sdc.health.data.HealthInfo zeHealthInfo = null;
- org.openecomp.sdc.health.data.HealthInfo beHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.BE, HealthCheckStatus.UP, getBEVersion(), "OK");
+ org.openecomp.sdc.health.data.HealthInfo beHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.BE,
+ HealthCheckStatus.UP, getBEVersion(), "OK");
org.openecomp.sdc.health.data.HealthInfo cassandraHealthInfo = null;
String zVersion = "Unknown";
try {
SessionContext context = ZusammenUtil.createSessionContext();
- ZusammenAdaptor zusammenAdaptor = ZusammenAdaptorFactory
- .getInstance().createInterface();
+ ZusammenAdaptor zusammenAdaptor = ZusammenAdaptorFactory.getInstance().createInterface();
Collection<HealthInfo> zeHealthInfos = new ArrayList<>();
try {
zeHealthInfos = zusammenAdaptor.checkHealth(context);
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
- zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.ZU, HealthCheckStatus.DOWN,
- zVersion, ex.getMessage());
+ zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, ex.getMessage());
}
boolean cassandraHealth = false;
String description = "OK";
@@ -77,47 +71,34 @@ public class HealthCheckManagerImpl implements HealthCheckManager {
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
description = ex.getMessage();
- cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion, ex.getMessage());
+ cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion,
+ ex.getMessage());
}
zVersion = zusammenAdaptor.getVersion(context);
if (cassandraHealthInfo == null) {
HealthCheckStatus status = cassandraHealth ? HealthCheckStatus.UP : HealthCheckStatus.DOWN;
- if (!cassandraHealth){
+ if (!cassandraHealth) {
description = "Cassandra is not available";
}
- cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.CAS, status,
- healthCheckDao.getVersion(), description);
+ cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.CAS, status, healthCheckDao.getVersion(),
+ description);
}
if (zeHealthInfo == null) {
- List<HealthInfo> downHealth = zeHealthInfos.stream().
- filter(h -> h.getHealthStatus().equals(HealthStatus.DOWN)).
- collect(Collectors.toList());
-
+ List<HealthInfo> downHealth = zeHealthInfos.stream().filter(h -> h.getHealthStatus().equals(HealthStatus.DOWN))
+ .collect(Collectors.toList());
if (downHealth.isEmpty()) {
- zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.ZU, HealthCheckStatus.UP,
- zVersion, "OK");
+ zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.ZU, HealthCheckStatus.UP, zVersion, "OK");
} else {
- String desc = downHealth.stream().map(healthInfo -> healthInfo.getDescription())
- .collect(Collectors.joining(" , ", "[", "]"));
- zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.ZU, HealthCheckStatus.DOWN,
- zVersion, desc);
+ String desc = downHealth.stream().map(healthInfo -> healthInfo.getDescription()).collect(Collectors.joining(" , ", "[", "]"));
+ zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, desc);
}
-
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
- zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, e.getMessage()
- );
- cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(
- MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion, e.getMessage());
+ zeHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.ZU, HealthCheckStatus.DOWN, zVersion, e.getMessage());
+ cassandraHealthInfo = new org.openecomp.sdc.health.data.HealthInfo(MonitoredModules.CAS, HealthCheckStatus.DOWN, zVersion,
+ e.getMessage());
}
return Arrays.asList(zeHealthInfo, beHealthInfo, cassandraHealthInfo);
}
-
-
}
-