diff options
author | ChrisC <cc697w@intl.att.com> | 2017-01-31 11:40:03 +0100 |
---|---|---|
committer | ChrisC <cc697w@intl.att.com> | 2017-01-31 12:59:33 +0100 |
commit | 025301d08b061482c1f046d562bf017c8cbcfe8d (patch) | |
tree | 68a2a549736c9bf0f7cd4e71c76e40ef7e2606f2 /common/src/test/java/org/openecomp/mso/utils | |
parent | 2754ad52f833278a5c925bd788a16d1dce16a598 (diff) |
Initial OpenECOMP MSO commit
Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d
Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'common/src/test/java/org/openecomp/mso/utils')
7 files changed, 645 insertions, 0 deletions
diff --git a/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTest.java b/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTest.java new file mode 100644 index 0000000000..212fe95407 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTest.java @@ -0,0 +1,124 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:02:57 GMT 2016 + */ + +package org.openecomp.mso.utils; + +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.List; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.PrivateAccess; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class CheckResultsESTest extends CheckResultsESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CheckResults checkResults0 = new CheckResults(); + checkResults0.addHostCheckResult("GP<QUZyf\"vf-sD", (-1), ""); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + CheckResults checkResults0 = new CheckResults(); + PrivateAccess.setVariable((Class<CheckResults>) CheckResults.class, checkResults0, "results", (Object) null); + List<CheckResults.CheckResult> list0 = checkResults0.getResults(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + checkResults_CheckResult0.setOutput("xp"); + assertEquals(0, checkResults_CheckResult0.getState()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + checkResults_CheckResult0.setType("2"); + assertEquals(0, checkResults_CheckResult0.getState()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + checkResults_CheckResult0.setState(1); + assertEquals(1, checkResults_CheckResult0.getState()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + checkResults_CheckResult0.setServicename("9~"); + assertEquals(0, checkResults_CheckResult0.getState()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + checkResults_CheckResult0.setHostname((String) null); + assertNull(checkResults_CheckResult0.getServicename()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + CheckResults checkResults0 = new CheckResults(); + checkResults0.addHostCheckResult("GP<QUZyf\"vf-sD", 0, "GP<QUZyf\"vf-sD"); + List<CheckResults.CheckResult> list0 = checkResults0.getResults(); + assertEquals(1, list0.size()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + CheckResults checkResults0 = new CheckResults(); + List<CheckResults.CheckResult> list0 = checkResults0.getResults(); + assertTrue(list0.isEmpty()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + String string0 = checkResults_CheckResult0.getServicename(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + int int0 = checkResults_CheckResult0.getState(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + String string0 = checkResults_CheckResult0.getHostname(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + String string0 = checkResults_CheckResult0.getType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + CheckResults checkResults0 = new CheckResults(); + checkResults0.addServiceCheckResult("", "Ifp73+/", 0, " "); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + CheckResults.CheckResult checkResults_CheckResult0 = new CheckResults.CheckResult(); + String string0 = checkResults_CheckResult0.getOutput(); + assertNull(string0); + } +} diff --git a/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTestscaffolding.java b/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTestscaffolding.java new file mode 100644 index 0000000000..a4fea268c1 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CheckResultsESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:02:57 GMT 2016 + */ + +package org.openecomp.mso.utils; + +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 CheckResultsESTestscaffolding { + + @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.utils.CheckResults"; + 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(CheckResultsESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.utils.CheckResults$CheckResult", + "org.openecomp.mso.utils.CheckResults" + ); + } + + private static void resetClasses() { + } +} diff --git a/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java b/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java new file mode 100644 index 0000000000..e178e4cf9c --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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========================================================= + */ + +package org.openecomp.mso.utils; + +import java.util.List; + +import org.junit.Test; + +import org.openecomp.mso.utils.CheckResults.CheckResult; + +public class CheckResultsTest { + + /** + * Test method for {@link org.openecomp.mso.utils.CheckResults#getResults()}. + */ + @Test + public final void testGetResults () { + CheckResults cr = new CheckResults (); + cr.addHostCheckResult ("host1", 0, "output"); + cr.addHostCheckResult ("host2", 2, "output2"); + cr.addServiceCheckResult ("host1", "service1", 0, "outputServ"); + cr.addServiceCheckResult ("host1", "service2", 2, "outputServ2"); + cr.addServiceCheckResult ("host2", "service1", 0, "output2Serv"); + cr.addServiceCheckResult ("host2", "service2", 2, "output2Serv2"); + List <CheckResult> res = cr.getResults (); + assert(res.size () == 6); + assert(res.get (0).getHostname ().equals ("host1")); + assert(res.get (1).getHostname ().equals ("host2")); + assert(res.get (2).getHostname ().equals ("host1")); + assert(res.get (3).getHostname ().equals ("host1")); + assert(res.get (4).getHostname ().equals ("host2")); + assert(res.get (5).getHostname ().equals ("host2")); + assert(res.get (0).getServicename () == null); + assert(res.get (3).getServicename ().equals ("service2")); + assert(res.get (5).getState () == 2); + } + +} diff --git a/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java new file mode 100644 index 0000000000..397db374bb --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java @@ -0,0 +1,175 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 09:07:10 GMT 2016 + */ + +package org.openecomp.mso.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +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 CryptoUtilsESTest extends CryptoUtilsESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CryptoUtils.decrypt("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", "00000000000000000000000000000000"); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + byte[] byteArray0 = new byte[0]; + CryptoUtils.byteArrayToHexString(byteArray0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt("AES", "w^p&|^Cvs@K.@@"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"w^\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt((String) null, "B2000000000000000000000000000000"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + try { + CryptoUtils.decrypt("B20000000000000000000000000000000000000000000000", "B20000000000000000000000000000000000000000000000"); + fail("Expecting exception: IllegalBlockSizeException"); + + } catch(IllegalBlockSizeException e) { + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + try { + CryptoUtils.decrypt("0000C200000000000000000000000000", "0000C200000000000000000000000000"); + fail("Expecting exception: BadPaddingException"); + + } catch(BadPaddingException e) { + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt("s.", "s."); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"s.\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt("", ""); + fail("Expecting exception: IllegalArgumentException"); + + } catch(IllegalArgumentException e) { + // + // Empty key + // + verifyException("javax.crypto.spec.SecretKeySpec", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.byteArrayToHexString((byte[]) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + byte[] byteArray0 = new byte[16]; + byteArray0[0] = (byte) (-78); + String string0 = CryptoUtils.byteArrayToHexString(byteArray0); + assertEquals("B2000000000000000000000000000000", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + String string0 = CryptoUtils.encrypt("00000000000000000000000000000000", "00000000000000000000000000000000"); + assertEquals("E08682BE5F2B18A6E8437A15B110D418E08682BE5F2B18A6E8437A15B110D4180143DB63EE66B0CDFF9F69917680151E", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.encrypt("", ""); + fail("Expecting exception: IllegalArgumentException"); + + } catch(IllegalArgumentException e) { + // + // Empty key + // + verifyException("javax.crypto.spec.SecretKeySpec", e); + } + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CryptoUtils cryptoUtils0 = new CryptoUtils(); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + // Undeclared exception! + try { + CryptoUtils.decrypt((String) null, "00000000000000000000000000000000"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } +} diff --git a/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTestscaffolding.java b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTestscaffolding.java new file mode 100644 index 0000000000..09574153c7 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 09:07:10 GMT 2016 + */ + +package org.openecomp.mso.utils; + +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 CryptoUtilsESTestscaffolding { + + @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.utils.CryptoUtils"; + 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(CryptoUtilsESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.utils.CryptoUtils" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CryptoUtilsESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.utils.CryptoUtils" + ); + } +} diff --git a/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTest.java b/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTest.java new file mode 100644 index 0000000000..fa8517e3db --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTest.java @@ -0,0 +1,34 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:02:03 GMT 2016 + */ + +package org.openecomp.mso.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import org.openecomp.mso.logger.MsoLogger; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.PrivateAccess; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class UUIDCheckerESTest extends UUIDCheckerESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoLogger msoLogger0 = mock(MsoLogger.class, new ViolatedAssumptionAnswer()); + String string0 = UUIDChecker.generateServiceInstanceID(msoLogger0); + assertEquals("00000000-0100-4000-8200-000003000000", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + UUIDChecker uUIDChecker0 = (UUIDChecker)PrivateAccess.callDefaultConstructorOfTheClassUnderTest(); + assertNotNull(uUIDChecker0); + } +} diff --git a/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTestscaffolding.java b/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTestscaffolding.java new file mode 100644 index 0000000000..15397cb165 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerESTestscaffolding.java @@ -0,0 +1,94 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:02:03 GMT 2016 + */ + +package org.openecomp.mso.utils; + +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 UUIDCheckerESTestscaffolding { + + @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.utils.UUIDChecker"; + 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(UUIDCheckerESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.logger.MsoLogger", + "org.openecomp.mso.logger.MessageEnum", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.entity.MsoRequest", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.i18n.EELFResourceManager", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.openecomp.mso.utils.UUIDChecker" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(UUIDCheckerESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "com.att.eelf.i18n.EELFResourceManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.logger.MsoLogger" + ); + } +} |