diff options
author | Arthur Martella <amartell@research.att.com> | 2017-09-08 13:27:46 -0400 |
---|---|---|
committer | Arthur Martella <amartell@research.att.com> | 2017-09-08 13:32:24 -0400 |
commit | 62cd6aaaf74aa91ee0037c0e155c8e7284f07567 (patch) | |
tree | 68c0c53c9156f5aa3c6b3599ac940770f986633d /status-control/src | |
parent | fa1a211d28a912892fcd888569df033900eb01ee (diff) |
1710 Rebase - Second Attempt
This commit rebases changes from openecomp-mso/internal-staging-1710 up to and including this codecloud commit:
54483fc6606ddb1591a2e9da61bff8712325f924
Wed Sep 6 18:12:56 2017 -0400
Rebasing was done on a branch on top of this commit in so/master in ONAP:
93fbdfbe46104f8859d4754040f979cb7997c157
Thu Sep 7 16:42:59 2017 +0000
Change-Id: I4ad9abf40da32bf5bdca43e868b8fa2dbcd9dc59
Issue-id: SO-107
Signed-off-by: Arthur Martella <amartell@research.att.com>
Diffstat (limited to 'status-control/src')
7 files changed, 4 insertions, 348 deletions
diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java index cd8cc7f13a..00d45a9235 100644 --- a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java +++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java @@ -62,7 +62,7 @@ public class HealthCheckUtils { public enum NodeType {APIH, RA, BPMN}; public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) { - try(CatalogDatabase catalogDB = new CatalogDatabase ()) { + try(CatalogDatabase catalogDB = CatalogDatabase.getInstance()) { catalogDB.healthCheck (); } catch (Exception e) { subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e); @@ -74,7 +74,7 @@ public class HealthCheckUtils { public boolean requestDBCheck (MsoLogger subMsoLogger, long startTime) { try { - RequestsDatabase.healthCheck (); + (RequestsDatabase.getInstance()).healthCheck (); } catch (Exception e) { subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check request database", e); subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception during local healthcheck"); diff --git a/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java b/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java index f125cbbc50..b182726439 100644 --- a/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java +++ b/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java @@ -51,7 +51,7 @@ public class MsoStatusHandler { // Query DB for the value try { - RequestsDatabase.updateSiteStatus(siteName, enable); + (RequestsDatabase.getInstance()).updateSiteStatus(siteName, enable); } catch (Exception e) { logger.error (MessageEnum.GENERAL_EXCEPTION, "", "setSiteStatus", MsoLogger.ErrorCode.DataError, "Failed to set site status", e); diff --git a/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java b/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java index 2a86a4a260..b9fab62b6f 100644 --- a/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java +++ b/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java @@ -34,7 +34,7 @@ public class MsoStatusUtil { // Query DB for the value try { - SiteStatus siteStatus = RequestsDatabase.getSiteStatus(siteName); + SiteStatus siteStatus = (RequestsDatabase.getInstance()).getSiteStatus(siteName); if (null != siteStatus) { return siteStatus.getStatus(); } else { diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java deleted file mode 100644 index 3fa901c51a..0000000000 --- a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 08:26:24 GMT 2016 - */ - -package org.openecomp.mso; - -import org.junit.Test; -import static org.junit.Assert.*; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class HealthCheckUtilsESTest extends HealthCheckUtilsESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils(); - MsoJavaProperties msoJavaProperties0 = healthCheckUtils0.loadTopologyProperties(); - assertNull(msoJavaProperties0); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils(); - MsoLogger.Catalog msoLogger_Catalog0 = MsoLogger.Catalog.BPEL; - MsoLogger msoLogger0 = MsoLogger.getMsoLogger(msoLogger_Catalog0); - boolean boolean0 = healthCheckUtils0.configFileCheck(msoLogger0, 0L, "58zhaz/qbA"); - assertFalse(boolean0); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils(); - MsoLogger.Catalog msoLogger_Catalog0 = MsoLogger.Catalog.BPEL; - MsoLogger msoLogger0 = MsoLogger.getMsoLogger(msoLogger_Catalog0); - boolean boolean0 = healthCheckUtils0.requestDBCheck(msoLogger0, 0L); - assertFalse(boolean0); - } -} diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java deleted file mode 100644 index fdb925abcf..0000000000 --- a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 08:26:24 GMT 2016 - */ - -package org.openecomp.mso; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class HealthCheckUtilsESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.HealthCheckUtils"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HealthCheckUtilsESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.properties.AbstractMsoProperties", - "org.openecomp.mso.properties.MsoPropertiesParameters", - "org.apache.http.client.config.RequestConfig", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.jboss.resteasy.specimpl.MultivaluedTreeMap", - "org.hibernate.criterion.Order", - "com.att.eelf.configuration.SLF4jWrapper", - "org.apache.http.HttpMessage", - "org.hibernate.Query", - "org.openecomp.mso.properties.MsoPropertiesException", - "org.openecomp.mso.requestsdb.InfraActiveRequests", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.HealthCheckUtils", - "org.hibernate.SessionFactory", - "org.apache.http.HttpRequest", - "com.att.eelf.i18n.EELFMsgs", - "org.openecomp.mso.properties.MsoPropertiesFactory", - "org.openecomp.mso.requestsdb.RequestsDatabase", - "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.requestsdb.MockRequestsDatabase", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.apache.http.client.config.RequestConfig$Builder", - "org.openecomp.mso.requestsdb.InfraRequests", - "org.openecomp.mso.requestsdb.SiteStatus", - "org.openecomp.mso.properties.MsoPropertiesParameters$MsoPropertiesType", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.apache.http.client.methods.HttpUriRequest", - "org.openecomp.mso.HealthCheckUtils$NodeType", - "com.att.eelf.configuration.EELFLogger", - "org.hibernate.engine.spi.Mapping", - "org.openecomp.mso.properties.MsoJavaProperties", - "org.apache.http.client.HttpClient", - "com.att.eelf.i18n.EELFResourceManager", - "org.jboss.resteasy.util.CaseInsensitiveMap$CaseInsensitiveComparator", - "org.hibernate.criterion.Criterion", - "org.openecomp.mso.logger.MessageEnum", - "org.apache.http.impl.client.CloseableHttpClient", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.entity.MsoRequest", - "org.openecomp.mso.properties.MsoJsonProperties", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "com.att.eelf.configuration.EELFManager", - "org.jboss.resteasy.util.CaseInsensitiveMap$1", - "org.jboss.resteasy.core.Headers", - "org.hibernate.BasicQueryContract", - "org.jboss.resteasy.util.CaseInsensitiveMap", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.apache.http.HttpResponse", - "org.openecomp.mso.requestsdb.HibernateUtil", - "org.apache.http.HttpHost" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(HealthCheckUtilsESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.HealthCheckUtils$NodeType", - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.properties.MsoPropertiesFactory", - "org.openecomp.mso.HealthCheckUtils", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.openecomp.mso.requestsdb.HibernateUtil", - "org.apache.http.client.config.RequestConfig", - "org.jboss.resteasy.specimpl.MultivaluedTreeMap", - "org.jboss.resteasy.util.CaseInsensitiveMap$CaseInsensitiveComparator", - "org.jboss.resteasy.util.CaseInsensitiveMap", - "org.jboss.resteasy.core.Headers", - "org.openecomp.mso.requestsdb.RequestsDatabase", - "org.openecomp.mso.properties.MsoPropertiesParameters$MsoPropertiesType", - "org.openecomp.mso.properties.MsoPropertiesException" - ); - } -} diff --git a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java deleted file mode 100644 index 3a05a7777b..0000000000 --- a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 08:26:39 GMT 2016 - */ - -package org.openecomp.mso; - -import org.junit.Test; -import static org.junit.Assert.*; - -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class MsoStatusUtilESTest extends MsoStatusUtilESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - MsoStatusUtil msoStatusUtil0 = new MsoStatusUtil(); - boolean boolean0 = msoStatusUtil0.getSiteStatus("getSiteStatus"); - assertFalse(boolean0); - } -} diff --git a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java deleted file mode 100644 index bd9141aa66..0000000000 --- a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 08:26:39 GMT 2016 - */ - -package org.openecomp.mso; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class MsoStatusUtilESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.MsoStatusUtil"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoStatusUtilESTestscaffolding.class.getClassLoader() , - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "com.att.eelf.configuration.EELFLogger", - "org.hibernate.engine.spi.Mapping", - "org.hibernate.criterion.Order", - "com.att.eelf.configuration.SLF4jWrapper", - "org.hibernate.Query", - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.requestsdb.InfraActiveRequests", - "org.hibernate.criterion.Criterion", - "org.openecomp.mso.logger.MsoLogger", - "org.openecomp.mso.logger.MessageEnum", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.entity.MsoRequest", - "org.hibernate.SessionFactory", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.MsoStatusUtil", - "com.att.eelf.i18n.EELFMsgs", - "org.openecomp.mso.requestsdb.RequestsDatabase", - "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.requestsdb.MockRequestsDatabase", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.hibernate.BasicQueryContract", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.openecomp.mso.requestsdb.HibernateUtil", - "org.openecomp.mso.requestsdb.InfraRequests", - "org.openecomp.mso.requestsdb.SiteStatus" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoStatusUtilESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.requestsdb.HibernateUtil", - "org.openecomp.mso.requestsdb.RequestsDatabase" - ); - } -} |