diff options
Diffstat (limited to 'status-control')
8 files changed, 6 insertions, 356 deletions
diff --git a/status-control/pom.xml b/status-control/pom.xml index 5a507929e7..4bf64ac657 100644 --- a/status-control/pom.xml +++ b/status-control/pom.xml @@ -6,7 +6,7 @@ <parent>
<groupId>org.openecomp.so</groupId>
<artifactId>so</artifactId>
- <version>1.1.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version>
</parent>
<groupId>org.openecomp.so</groupId>
@@ -15,12 +15,6 @@ <description>Contains classes to update and query the MSO status per site</description>
<dependencies>
- <dependency>
- <groupId>org.evosuite</groupId>
- <artifactId>evosuite-standalone-runtime</artifactId>
- <version>${evosuiteVersion}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.openecomp.so</groupId>
<artifactId>common</artifactId>
@@ -70,4 +64,4 @@ </dependency>
</dependencies>
-</project> +</project>
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" - ); - } -} |