/** * Copyright (C) 2010-2017 Gordon Fraser, Andrea Arcuri and EvoSuite * contributors * * This file is part of EvoSuite. * * EvoSuite is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3.0 of the License, or * (at your option) any later version. * * EvoSuite is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with EvoSuite. If not, see <http://www.gnu.org/licenses/>. */ /** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Fri Oct 23 18:07:57 GMT 2015 */ package org.evosuite.runtime.util; import shaded.org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import shaded.org.evosuite.runtime.sandbox.Sandbox; import shaded.org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class ByteDataInputStream_ESTest_scaffolding { @org.junit.Rule public org.junit.rules.Timeout globalTimeout = new org.junit.rules.Timeout(4000); private static final java.util.Properties defaultProperties = (java.util.Properties) System.getProperties().clone(); private shaded.org.evosuite.runtime.thread.ThreadStopper threadStopper = new shaded.org.evosuite.runtime.thread.ThreadStopper (shaded.org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { shaded.org.evosuite.runtime.RuntimeSettings.className = "org.evosuite.runtime.util.ByteDataInputStream"; shaded.org.evosuite.runtime.GuiSupport.initialize(); shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; shaded.org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; shaded.org.evosuite.runtime.RuntimeSettings.sandboxMode = shaded.org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; shaded.org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); initializeClasses(); shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); shaded.org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); shaded.org.evosuite.runtime.GuiSupport.setHeadless(); shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); resetClasses(); shaded.org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); shaded.org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public void setSystemProperties() { System.setProperties((java.util.Properties) defaultProperties.clone()); System.setProperty("java.vm.vendor", "Oracle Corporation"); System.setProperty("java.specification.version", "1.8"); System.setProperty("java.home", "/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre"); System.setProperty("user.dir", "/Users/foo/WORK/evosuite/runtime"); System.setProperty("java.io.tmpdir", "/var/folders/hx/38wkxnjn0k35f998lgmc87180000gp/T/"); System.setProperty("line.separator", "\n"); } private static void initializeClasses() { shaded.org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ByteDataInputStream_ESTest_scaffolding.class.getClassLoader() , "org.evosuite.runtime.mock.EvoSuiteMock", "org.evosuite.runtime.mock.OverrideMock", "org.evosuite.runtime.mock.java.io.MockIOException", "org.evosuite.runtime.util.ByteDataInputStream", "org.evosuite.runtime.mock.java.lang.MockThrowable" ); } private static void resetClasses() { shaded.org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ByteDataInputStream_ESTest_scaffolding.class.getClassLoader()); shaded.org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.evosuite.runtime.mock.java.io.MockIOException" ); } }