/** * 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 * Mon Dec 14 19:36:29 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 ComputeClassWriter_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) java.lang.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.ComputeClassWriter"; 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(); shaded.org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); shaded.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(); 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(); shaded.org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); shaded.org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); shaded.org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("java.vm.vendor", "Oracle Corporation"); java.lang.System.setProperty("java.specification.version", "1.8"); java.lang.System.setProperty("java.home", "/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre"); java.lang.System.setProperty("user.dir", "/Users/foo/WORK/evosuite/runtime"); java.lang.System.setProperty("java.io.tmpdir", "/var/folders/hx/38wkxnjn0k35f998lgmc87180000gp/T/"); java.lang.System.setProperty("awt.toolkit", "sun.lwawt.macosx.LWCToolkit"); java.lang.System.setProperty("file.encoding", "UTF-8"); java.lang.System.setProperty("file.separator", "/"); java.lang.System.setProperty("java.awt.graphicsenv", "sun.awt.CGraphicsEnvironment"); java.lang.System.setProperty("java.awt.headless", "true"); java.lang.System.setProperty("java.awt.printerjob", "sun.lwawt.macosx.CPrinterJob"); java.lang.System.setProperty("java.class.path", "/var/folders/hx/38wkxnjn0k35f998lgmc87180000gp/T/EvoSuite_pathingJar1384446840246655209.jar"); java.lang.System.setProperty("java.class.version", "52.0"); java.lang.System.setProperty("java.endorsed.dirs", "/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/endorsed"); java.lang.System.setProperty("java.ext.dirs", "/Users/foo/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"); java.lang.System.setProperty("java.library.path", "lib"); java.lang.System.setProperty("java.runtime.name", "Java(TM) SE Runtime Environment"); java.lang.System.setProperty("java.runtime.version", "1.8.0_51-b16"); java.lang.System.setProperty("java.specification.name", "Java Platform API Specification"); java.lang.System.setProperty("java.specification.vendor", "Oracle Corporation"); java.lang.System.setProperty("java.vendor", "Oracle Corporation"); java.lang.System.setProperty("java.vendor.url", "http://java.oracle.com/"); java.lang.System.setProperty("java.version", "1.8.0_51"); java.lang.System.setProperty("java.vm.info", "mixed mode"); java.lang.System.setProperty("java.vm.name", "Java HotSpot(TM) 64-Bit Server VM"); java.lang.System.setProperty("java.vm.specification.name", "Java Virtual Machine Specification"); java.lang.System.setProperty("java.vm.specification.vendor", "Oracle Corporation"); java.lang.System.setProperty("java.vm.specification.version", "1.8"); java.lang.System.setProperty("java.vm.version", "25.51-b03"); java.lang.System.setProperty("line.separator", "\n"); java.lang.System.setProperty("os.arch", "x86_64"); java.lang.System.setProperty("os.name", "Mac OS X"); java.lang.System.setProperty("os.version", "10.10"); java.lang.System.setProperty("path.separator", ":"); java.lang.System.setProperty("user.country", "US"); java.lang.System.setProperty("user.home", "/Users/foo"); java.lang.System.setProperty("user.language", "en"); java.lang.System.setProperty("user.name", "foo"); java.lang.System.setProperty("user.timezone", "Europe/Oslo"); } private static void initializeClasses() { shaded.org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ComputeClassWriter_ESTest_scaffolding.class.getClassLoader() , "org.objectweb.asm.ClassWriter", "org.objectweb.asm.AnnotationVisitor", "org.objectweb.asm.ByteVector", "org.objectweb.asm.MethodVisitor", "org.objectweb.asm.FieldWriter", "org.objectweb.asm.FieldVisitor", "org.objectweb.asm.Label", "org.objectweb.asm.Type", "org.objectweb.asm.Item", "org.objectweb.asm.Handle", "org.objectweb.asm.Context", "org.objectweb.asm.TypePath", "org.objectweb.asm.ClassReader", "org.objectweb.asm.Attribute", "org.objectweb.asm.AnnotationWriter", "org.objectweb.asm.MethodWriter", "org.objectweb.asm.ClassVisitor", "org.objectweb.asm.Frame", "org.evosuite.runtime.util.ComputeClassWriter" ); } private static void resetClasses() { shaded.org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ComputeClassWriter_ESTest_scaffolding.class.getClassLoader()); shaded.org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.objectweb.asm.ClassWriter", "org.objectweb.asm.ClassReader", "org.objectweb.asm.Type", "org.objectweb.asm.TypePath", "org.objectweb.asm.Frame" ); } }