dbbce2d67bf35aa90b912b718242d5bb3fbfa848
[so.git] / bpmn / MSOURN-plugin / src / test / java / org / openecomp / camunda / bpmn / plugin / urnmap / db / URNServiceESTestscaffolding.java
1 /**\r
2  * Scaffolding file used to store all the setups needed to run \r
3  * tests automatically generated by EvoSuite\r
4  * Mon Nov 14 13:47:07 GMT 2016\r
5  */\r
6 \r
7 package org.openecomp.camunda.bpmn.plugin.urnmap.db;\r
8 \r
9 import org.evosuite.runtime.annotation.EvoSuiteClassExclude;\r
10 import org.junit.BeforeClass;\r
11 import org.junit.Before;\r
12 import org.junit.After;\r
13 import org.junit.AfterClass;\r
14 import org.evosuite.runtime.sandbox.Sandbox;\r
15 \r
16 @EvoSuiteClassExclude\r
17 public class URNServiceESTestscaffolding {\r
18 \r
19   @org.junit.Rule \r
20   public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();\r
21 \r
22   private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); \r
23 \r
24   private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);\r
25 \r
26   @BeforeClass \r
27   public static void initEvoSuiteFramework() { \r
28     org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService"; \r
29     org.evosuite.runtime.GuiSupport.initialize(); \r
30     org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; \r
31     org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; \r
32     org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; \r
33     org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; \r
34     org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); \r
35     org.evosuite.runtime.classhandling.JDKClassResetter.init(); \r
36     initializeClasses();\r
37     org.evosuite.runtime.Runtime.getInstance().resetRuntime(); \r
38   } \r
39 \r
40   @AfterClass \r
41   public static void clearEvoSuiteFramework(){ \r
42     Sandbox.resetDefaultSecurityManager(); \r
43     java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); \r
44   } \r
45 \r
46   @Before \r
47   public void initTestCase(){ \r
48     threadStopper.storeCurrentThreads();\r
49     threadStopper.startRecordingTime();\r
50     org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); \r
51     org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); \r
52      \r
53     org.evosuite.runtime.GuiSupport.setHeadless(); \r
54     org.evosuite.runtime.Runtime.getInstance().resetRuntime(); \r
55     org.evosuite.runtime.agent.InstrumentingAgent.activate(); \r
56   } \r
57 \r
58   @After \r
59   public void doneWithTestCase(){ \r
60     threadStopper.killAndJoinClientThreads();\r
61     org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); \r
62     org.evosuite.runtime.classhandling.JDKClassResetter.reset(); \r
63     resetClasses(); \r
64     org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); \r
65     org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); \r
66     org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); \r
67   } \r
68 \r
69 \r
70   private static void initializeClasses() {\r
71     org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(URNServiceESTestscaffolding.class.getClassLoader() ,\r
72       "org.camunda.bpm.engine.ProcessEngineException",\r
73       "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService",\r
74       "org.camunda.bpm.engine.impl.interceptor.Command",\r
75       "org.camunda.bpm.engine.ClassLoadingException",\r
76       "org.camunda.bpm.engine.ProcessEngine",\r
77       "org.camunda.bpm.engine.ProcessEngines",\r
78       "org.camunda.bpm.engine.ProcessEngineInfo",\r
79       "org.camunda.bpm.application.ProcessApplicationUnavailableException",\r
80       "org.camunda.bpm.engine.impl.ProcessEngineImpl",\r
81       "org.camunda.bpm.engine.impl.context.Context",\r
82       "org.camunda.bpm.engine.impl.util.ReflectUtil",\r
83       "org.camunda.bpm.engine.ProcessEngineServices",\r
84       "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData"\r
85     );\r
86   } \r
87 \r
88   private static void resetClasses() {\r
89     org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(URNServiceESTestscaffolding.class.getClassLoader());\r
90 \r
91     org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(\r
92       "org.camunda.bpm.engine.impl.context.Context",\r
93       "org.camunda.bpm.engine.ProcessEngines",\r
94       "org.camunda.bpm.engine.impl.util.ReflectUtil"\r
95     );\r
96   }\r
97 }\r