From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../openecomp/mso/bpmn/core/BPMNLoggerESTest.java | 30 ++ .../mso/bpmn/core/BPMNLoggerESTestscaffolding.java | 106 ++++ .../bpmn/core/BadInjectedFieldExceptionESTest.java | 24 + ...BadInjectedFieldExceptionESTestscaffolding.java | 83 ++++ .../org/openecomp/mso/bpmn/core/JsonUtilsTest.java | 255 ++++++++++ .../org/openecomp/mso/bpmn/core/LogTaskESTest.java | 41 ++ .../mso/bpmn/core/LogTaskESTestscaffolding.java | 342 +++++++++++++ .../core/MissingInjectedFieldExceptionESTest.java | 20 + ...ingInjectedFieldExceptionESTestscaffolding.java | 85 ++++ .../mso/bpmn/core/PropertyConfigurationTest.java | 115 +++++ .../mso/bpmn/core/ReadConfigTaskESTest.java | 58 +++ .../bpmn/core/ReadConfigTaskESTestscaffolding.java | 331 +++++++++++++ .../mso/bpmn/core/ReadFileTaskESTest.java | 58 +++ .../bpmn/core/ReadFileTaskESTestscaffolding.java | 339 +++++++++++++ .../mso/bpmn/core/RollbackDataESTest.java | 117 +++++ .../bpmn/core/RollbackDataESTestscaffolding.java | 83 ++++ .../org/openecomp/mso/bpmn/core/TestBaseTask.java | 262 ++++++++++ .../mso/bpmn/core/URNMappingsTaskESTest.java | 27 ++ .../core/URNMappingsTaskESTestscaffolding.java | 103 ++++ .../mso/bpmn/core/WorkflowExceptionESTest.java | 88 ++++ .../core/WorkflowExceptionESTestscaffolding.java | 83 ++++ .../mso/bpmn/core/XQueryScriptTaskESTest.java | 81 ++++ .../core/XQueryScriptTaskESTestscaffolding.java | 533 +++++++++++++++++++++ .../mso/bpmn/core/json/JsonUtilsESTest.java | 165 +++++++ .../bpmn/core/json/JsonUtilsESTestscaffolding.java | 120 +++++ .../mso/bpmn/core/mybatis/URNMappingESTest.java | 114 +++++ .../core/mybatis/URNMappingESTestscaffolding.java | 78 +++ 27 files changed, 3741 insertions(+) create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java (limited to 'bpmn/MSOCoreBPMN/src/test/java') diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java new file mode 100644 index 0000000000..71b9e089c3 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java @@ -0,0 +1,30 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:35:04 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +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 BPMNLoggerESTest extends BPMNLoggerESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + BPMNLogger.debug("true", "<,A1M\"[ K3\\u"); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + BPMNLogger.debug("trud", (String) null); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + BPMNLogger bPMNLogger0 = new BPMNLogger(); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java new file mode 100644 index 0000000000..2449157b43 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java @@ -0,0 +1,106 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:35:04 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 BPMNLoggerESTestscaffolding { + + @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.bpmn.core.BPMNLogger"; + 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(BPMNLoggerESTestscaffolding.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.entity.MsoRequest", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "com.att.eelf.configuration.EELFLogger", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.configuration.EELFLogger$Level", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "com.att.eelf.configuration.SLF4jWrapper", + "org.openecomp.mso.bpmn.core.BPMNLogger", + "com.att.eelf.i18n.EELFResourceManager" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BPMNLoggerESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "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.logger.MessageEnum", + "org.openecomp.mso.bpmn.core.BPMNLogger" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java new file mode 100644 index 0000000000..113c819f8c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java @@ -0,0 +1,24 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:35:23 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 BadInjectedFieldExceptionESTest extends BadInjectedFieldExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + BadInjectedFieldException badInjectedFieldException0 = new BadInjectedFieldException("", "", ""); + BadInjectedFieldException badInjectedFieldException1 = new BadInjectedFieldException("y#,,", "4tX0!<", (Object) badInjectedFieldException0, (Throwable) badInjectedFieldException0); + assertFalse(badInjectedFieldException1.equals((Object)badInjectedFieldException0)); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java new file mode 100644 index 0000000000..69ee3dcd48 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:35:23 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 BadInjectedFieldExceptionESTestscaffolding { + + @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.bpmn.core.BadInjectedFieldException"; + 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(BadInjectedFieldExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.bpmn.core.BadInjectedFieldException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BadInjectedFieldExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.BadInjectedFieldException" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java new file mode 100644 index 0000000000..6176029075 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java @@ -0,0 +1,255 @@ +/*- + * ============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.bpmn.core; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.xml.sax.SAXException; +import org.custommonkey.xmlunit.Diff; + +import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.bpmn.core.xml.XmlTool; + +/** + * @version 1.0 + */ +public class JsonUtilsTest { + + private static final String EOL = "\n"; + private String xmlReq = + "" + EOL + + " " + EOL + + " DEV-VF-0021" + EOL + + " CREATE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " STMTN5MMSC21-MMSC::model-1-0" + EOL + + " true" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " 1.0" + EOL + + " 999999999-0000-0000-0000-000000000000" + EOL + + " 1.5" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " 1" + EOL + + " " + EOL + + " " + EOL + + " network1111" + EOL + + " server1111" + EOL + + " " + EOL + + "" + EOL; + + private String xmlReqNoAttrs = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + // JSON request w/ embedded XML will be read from a file + private String jsonReq = null; + + @Before + public void initialize() { + File file = new File("src/test/resources/request.json"); + FileInputStream fis = null; + + try { + fis = new FileInputStream(file); + BufferedReader br = new BufferedReader(new InputStreamReader(fis)); + jsonReq = br.readLine(); + if (jsonReq != null) { + System.out.println("initialize(): json request: " + jsonReq); + } else { + System.out.println("initialize(): failed to read json request from src/test/resources/request.json"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fis != null) + fis.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @After + public void cleanup(){ + } + + @Test + public void testConversion() { + // Note: the current version of the JsonUtils.json2xml() method + // does not support converting the JSONObject representation + // of XML attributes (JSONArray) back to XML. So this test will + // only succeed if the original XML does not contain attributes + + // save a copy of the xml with the namespaces removed + String xmlIn = XmlTool.removeNamespaces(xmlReqNoAttrs); + // strip all the whitespace + xmlIn = xmlIn.replaceAll("\\s+",""); + String json = JsonUtils.xml2json(xmlReqNoAttrs); + System.out.println("testConversion(): xml request to json: " + json); + String xmlOut = JsonUtils.json2xml(json); + System.out.println("testConversion(): json request back to xml: " + xmlOut); + + // strip all the whitespace + xmlOut = xmlOut.replaceAll("\\s+",""); +// System.out.println("testConversion(): xml in: " + xmlIn); +// System.out.println("testConversion(): xml out: " + xmlOut); + + Diff diffXml; + try { + diffXml = new Diff(xmlIn, xmlOut); + Assert.assertTrue(diffXml.similar()); +// Assert.assertTrue(diffXml.identical()); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void testRetrieval() { + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testRetrieval(): xml request to json: " + json); + // full JSON path + String value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC21"); + value = JsonUtils.getJsonValue(json, "vnf-request.request-info.action"); + Assert.assertEquals(value, "CREATE_VF_MODULE"); + // retrieving an integer + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version"); + Assert.assertEquals(value, "1"); + // retrieving a float + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version"); + Assert.assertEquals(value, "1.5"); + // retrieving a boolean + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module"); + Assert.assertEquals(value, "true"); + // attempt to retrieve a value for a non-existent field + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad"); + Assert.assertEquals(value, null); + // retrieving a parameter value (originally a XML attribute) + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "server"); +// Assert.assertEquals(value, "[{\"content\":\"network1111\",\"name\":\"network\"},{\"content\":\"server1111\",\"name\":\"server\"}]"); + Assert.assertEquals(value, "server1111"); + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam"); + Assert.assertEquals(value, null); + // by field name/key + value = JsonUtils.getJsonValueForKey(json, "source"); + Assert.assertEquals(value, "PORTAL"); + value = JsonUtils.getJsonValueForKey(json, "vnf-module"); + Assert.assertEquals(value, null); + } + + @Test + public void testUpdate() { + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testUpdate(): xml request to json: " + json); + // the add should be successful + String jsonUpd = JsonUtils.addJsonValue(json, "vnf-request.request-info.comment", "Some comment"); +// System.out.println("testUpdate(): post add json request: " + jsonUpd); + String value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); + Assert.assertEquals(value, "Some comment"); + // the add should be ignored as the field already exists + jsonUpd = JsonUtils.addJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC21"); + // the update should be successful + jsonUpd = JsonUtils.updJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); +// System.out.println("testUpdate(): post update json request: " + jsonUpd); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC22"); + // the delete should be successful + jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.request-info.comment"); +// System.out.println("testUpdate(): post delete json request: " + jsonUpd); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); + Assert.assertEquals(value, null); + // the delete should fail as field 'vnf-model' does not exist + String jsonCur = jsonUpd; + jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-module"); + Assert.assertEquals(jsonCur, jsonUpd); + } + + @Test + public void testEmbededXmlRetrievalConversion() { + try { + // extract the embedded XML from the request + String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); + String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); + System.out.println("testEmbededXmlRetrievalConversion(): xml payload: " + xmlReq); + // strip all the whitespace +// xmlIn = xmlIn.replaceAll("\\s+",""); + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testEmbededXmlRetrievalConversion(): xml request to json: " + json); + String xmlOut = JsonUtils.json2xml(json); + System.out.println("testEmbededXmlRetrievalConversion(): json request back to xml: " + xmlOut); + Diff diffXml; + try { + // compare the XML before and after + diffXml = new Diff(xmlReq, xmlOut); + Assert.assertTrue(diffXml.similar()); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java new file mode 100644 index 0000000000..70e505095e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java @@ -0,0 +1,41 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:29:34 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +import static org.junit.Assert.*; + +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +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 LogTaskESTest extends LogTaskESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + LogTask logTask0 = null; + try { + logTask0 = new LogTask(); + fail("Expecting exception: NoClassDefFoundError"); + + } catch(NoClassDefFoundError e) { + } + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ExecutionImpl executionImpl0 = new ExecutionImpl(); + LogTask logTask0 = null; + try { + logTask0 = new LogTask(); + fail("Expecting exception: NoClassDefFoundError"); + + } catch(NoClassDefFoundError e) { + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java new file mode 100644 index 0000000000..ab7ee56884 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java @@ -0,0 +1,342 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:29:34 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 LogTaskESTestscaffolding { + + @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.bpmn.core.LogTask"; + 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(LogTaskESTestscaffolding.class.getClassLoader() , + "org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity", + "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.context.CaseExecutionContext", + "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", + "org.camunda.bpm.engine.impl.pvm.PvmScope", + "org.camunda.bpm.engine.delegate.JavaDelegate", + "org.camunda.bpm.engine.runtime.ProcessInstance", + "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", + "org.camunda.bpm.application.ProcessApplicationReference", + "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", + "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", + "org.camunda.bpm.engine.delegate.DelegateExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", + "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", + "com.att.eelf.i18n.EELFMsgs", + "org.camunda.bpm.engine.impl.javax.el.ELContext", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", + "org.camunda.bpm.engine.variable.type.ValueType", + "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", + "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", + "org.camunda.bpm.engine.repository.CaseDefinition", + "org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity", + "org.camunda.bpm.engine.impl.db.HasDbRevision", + "org.camunda.bpm.model.bpmn.instance.FlowElement", + "org.camunda.bpm.engine.delegate.Expression", + "org.camunda.bpm.engine.variable.type.SerializableValueType", + "org.camunda.bpm.engine.impl.pvm.PvmActivity", + "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", + "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", + "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.task.DelegationState", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.application.ProcessApplicationUnavailableException", + "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", + "org.camunda.bpm.engine.delegate.DelegateCaseExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", + "org.camunda.bpm.engine.runtime.CaseExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", + "org.camunda.bpm.engine.repository.ProcessDefinition", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.camunda.bpm.engine.task.IdentityLink", + "org.camunda.bpm.engine.impl.interceptor.SessionFactory", + "org.camunda.bpm.engine.delegate.DelegateTask", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.model.bpmn.BpmnModelInstance", + "org.camunda.bpm.engine.delegate.VariableScope", + "org.camunda.bpm.engine.ProcessEngine", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.interceptor.CommandContext", + "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", + "org.camunda.bpm.engine.impl.cfg.auth.ResourceAuthorizationProvider", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.camunda.bpm.engine.BadUserRequestException", + "org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity", + "org.camunda.bpm.engine.impl.context.ExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.authorization.Authorization", + "org.camunda.bpm.engine.ProcessEngineServices", + "org.camunda.bpm.engine.runtime.Execution", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.impl.pvm.process.Lane", + "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", + "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", + "org.camunda.bpm.engine.ProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.util.BitMaskUtil", + "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", + "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", + "org.camunda.bpm.engine.delegate.BaseDelegateExecution", + "org.camunda.bpm.engine.impl.pvm.PvmExecution", + "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", + "org.camunda.bpm.engine.runtime.VariableInstance", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", + "org.camunda.bpm.engine.runtime.Job", + "org.camunda.bpm.engine.runtime.Incident", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState$CaseExecutionStateImpl", + "org.camunda.bpm.model.xml.ModelInstance", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", + "org.openecomp.mso.entity.MsoRequest", + "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.camunda.bpm.model.bpmn.instance.UserTask", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", + "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", + "org.camunda.bpm.engine.impl.task.TaskDecorator", + "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", + "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", + "org.camunda.bpm.model.xml.instance.ModelElementInstance", + "org.camunda.bpm.engine.ProcessEngineException", + "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", + "org.camunda.bpm.engine.impl.db.DbEntity", + "org.camunda.bpm.model.bpmn.instance.InteractionNode", + "org.camunda.bpm.engine.impl.task.TaskDefinition", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", + "org.camunda.bpm.engine.runtime.EventSubscription", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", + "org.camunda.bpm.model.bpmn.instance.Activity", + "org.camunda.bpm.engine.management.JobDefinition", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "com.att.eelf.configuration.EELFLogger$Level", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", + "org.camunda.bpm.engine.impl.javax.el.ValueReference", + "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", + "org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", + "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", + "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "com.att.eelf.configuration.EELFLogger", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", + "org.camunda.bpm.engine.runtime.CaseInstance", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", + "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseSentryPartImpl", + "org.camunda.bpm.engine.variable.value.TypedValue", + "org.openecomp.mso.logger.MsoAlarmLogger", + "org.apache.ibatis.transaction.TransactionFactory", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", + "org.camunda.bpm.engine.impl.pvm.process.LaneSet", + "org.camunda.bpm.engine.delegate.DelegateListener", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntityVariableStore", + "org.camunda.bpm.engine.delegate.ExecutionListener", + "org.camunda.bpm.engine.exception.NotAllowedException", + "org.camunda.bpm.engine.impl.history.event.HistoryEventType", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.openecomp.mso.bpmn.core.LogTask", + "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", + "com.att.eelf.configuration.SLF4jWrapper", + "org.camunda.bpm.engine.task.Task", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.context.CoreExecutionContext", + "org.camunda.bpm.engine.delegate.DelegateVariableInstance", + "org.camunda.bpm.model.bpmn.instance.FlowNode", + "org.openecomp.mso.logger.MsoLogger", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.model.cmmn.CmmnModelInstance", + "org.camunda.bpm.model.bpmn.instance.Task", + "org.camunda.bpm.engine.variable.VariableMap", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", + "org.camunda.bpm.model.bpmn.instance.BaseElement", + "org.camunda.bpm.engine.exception.NullValueException", + "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", + "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", + "org.openecomp.mso.bpmn.core.BaseTask", + "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", + "org.apache.ibatis.session.SqlSessionFactory", + "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", + "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", + "com.att.eelf.i18n.EELFResourceManager", + "org.camunda.bpm.engine.impl.el.FixedValue", + "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.camunda.bpm.engine.SuspendedEntityInteractionException", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.camunda.bpm.engine.impl.db.HasDbReferences", + "org.camunda.bpm.engine.impl.tree.Collector", + "com.att.eelf.configuration.EELFManager", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", + "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", + "org.camunda.bpm.engine.impl.el.Expression", + "org.camunda.bpm.engine.impl.pvm.PvmTransition", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.model.cmmn.instance.CmmnElement", + "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", + "org.camunda.bpm.engine.impl.jobexecutor.JobHandler", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", + "org.camunda.bpm.engine.variable.type.PrimitiveValueType", + "org.camunda.bpm.engine.delegate.VariableListener", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(LogTaskESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "org.camunda.bpm.engine.ProcessEngineException", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.exception.NullValueException", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", + "org.camunda.bpm.engine.impl.util.BitMaskUtil", + "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", + "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "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.logger.MessageEnum", + "org.openecomp.mso.logger.MsoAlarmLogger", + "org.openecomp.mso.bpmn.core.LogTask" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java new file mode 100644 index 0000000000..f62d6afaf0 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java @@ -0,0 +1,20 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:35:52 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +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 MissingInjectedFieldExceptionESTest extends MissingInjectedFieldExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MissingInjectedFieldException missingInjectedFieldException0 = new MissingInjectedFieldException("", ""); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java new file mode 100644 index 0000000000..03cb94f4e6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java @@ -0,0 +1,85 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:35:52 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 MissingInjectedFieldExceptionESTestscaffolding { + + @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.bpmn.core.MissingInjectedFieldException"; + 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(MissingInjectedFieldExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MissingInjectedFieldExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java new file mode 100644 index 0000000000..ff92355b8a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java @@ -0,0 +1,115 @@ +/*- + * ============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.bpmn.core; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import org.openecomp.mso.bpmn.test.PropertyConfigurationSetup; + +public class PropertyConfigurationTest { + @Before + public void beforeTest() throws IOException { + Map defaultProperties = PropertyConfigurationSetup.createBpmnProperties(); + defaultProperties.put("testValue", "testKey"); + PropertyConfigurationSetup.init(defaultProperties); + } + + @Test + public void testPropertyFileWatcher() throws InterruptedException, IOException { + Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning()); + } + + @Test + public void testPropertyLoading() throws IOException, InterruptedException { + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); + Assert.assertNotNull(props); + Assert.assertEquals("testValue", props.get("testKey")); + } + + @Test + public void testPropertyReload() throws IOException, InterruptedException { + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); + Assert.assertNotNull(properties); + Assert.assertEquals("testValue", properties.get("testKey")); + + Map newProperties = PropertyConfigurationSetup.createBpmnProperties(); + newProperties.put("newKey", "newValue"); + PropertyConfigurationSetup.addProperties(newProperties, 10000); + + // Reload and check for the new value + properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); + Assert.assertNotNull(properties); + Assert.assertEquals("newValue", properties.get("newKey")); + } + + @Test(expected=IllegalArgumentException.class) + public void testPropertyFileDoesNotExists_NotIntheList() throws IOException { + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + propertyConfiguration.getProperties("badfile.properties"); + Assert.fail("Expected IllegalArgumentException"); + } + + @Test(expected=java.lang.UnsupportedOperationException.class) + public void testPropertyModificationException() throws IOException { + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); + Assert.assertNotNull(props); + Assert.assertEquals("testValue", props.get("testKey")); + props.put("newKey", "newvalue"); + } + + @Test + public void testNotAllowedPropertyReloading() throws IOException { + Path msoConfigPath = Paths.get(System.getProperty("mso.config.path")); + Path backupPropFilePath = msoConfigPath.resolve("backup-" + PropertyConfiguration.MSO_BPMN_PROPERTIES); + + try { + // Create a new file... a backup file + Files.createFile(backupPropFilePath); + + // Load properties + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES); + Assert.assertNotNull(props); + Assert.assertEquals("testValue", props.get("testKey")); + + // Update the backup file + Path bpmnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.properties"); + Files.copy(bpmnPropertiesSourcePath, backupPropFilePath, StandardCopyOption.REPLACE_EXISTING); + + // Cache size should remain the same + Assert.assertEquals(1, PropertyConfiguration.getInstance().cacheSize()); + } finally { + backupPropFilePath.toFile().delete(); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java new file mode 100644 index 0000000000..6422685f92 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java @@ -0,0 +1,58 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:29:36 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +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 ReadConfigTaskESTest extends ReadConfigTaskESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ReadConfigTask readConfigTask0 = new ReadConfigTask(); + ExecutionImpl executionImpl0 = new ExecutionImpl(); + Expression expression0 = mock(Expression.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(expression0).getValue(any(org.camunda.bpm.engine.delegate.VariableScope.class)); + PrivateAccess.setVariable((Class) ReadConfigTask.class, readConfigTask0, "propertiesFile", (Object) expression0); + try { + readConfigTask0.execute(executionImpl0); + fail("Expecting exception: RuntimeException"); + + } catch(RuntimeException e) { + // + // ReadConfigTask injected field 'propertiesFile' is bad: required field has null value + // + verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); + } + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ReadConfigTask readConfigTask0 = new ReadConfigTask(); + ExecutionImpl executionImpl0 = new ExecutionImpl(); + try { + readConfigTask0.execute(executionImpl0); + fail("Expecting exception: RuntimeException"); + + } catch(RuntimeException e) { + // + // ReadConfigTask injected field 'propertiesFile' is bad: missing required field + // + verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java new file mode 100644 index 0000000000..c134c9cca9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java @@ -0,0 +1,331 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:29:36 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 ReadConfigTaskESTestscaffolding { + + @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.bpmn.core.ReadConfigTask"; + 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(ReadConfigTaskESTestscaffolding.class.getClassLoader() , + "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.context.CaseExecutionContext", + "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", + "org.camunda.bpm.engine.impl.pvm.PvmScope", + "org.camunda.bpm.engine.delegate.JavaDelegate", + "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", + "org.camunda.bpm.engine.runtime.ProcessInstance", + "org.camunda.bpm.application.ProcessApplicationReference", + "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", + "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", + "org.camunda.bpm.engine.delegate.DelegateExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", + "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", + "com.att.eelf.i18n.EELFMsgs", + "org.camunda.bpm.engine.impl.javax.el.ELContext", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceStart", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", + "org.camunda.bpm.engine.variable.type.ValueType", + "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", + "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationInterruptScope", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", + "org.camunda.bpm.engine.repository.CaseDefinition", + "org.camunda.bpm.engine.impl.db.HasDbRevision", + "org.camunda.bpm.model.bpmn.instance.FlowElement", + "org.camunda.bpm.engine.delegate.Expression", + "org.camunda.bpm.engine.variable.type.SerializableValueType", + "org.camunda.bpm.engine.impl.pvm.PvmActivity", + "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", + "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", + "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.application.ProcessApplicationUnavailableException", + "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", + "org.camunda.bpm.engine.delegate.DelegateCaseExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerTake", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", + "org.camunda.bpm.engine.runtime.CaseExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", + "org.camunda.bpm.engine.repository.ProcessDefinition", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartConcurrent", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake", + "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", + "org.camunda.bpm.engine.impl.interceptor.SessionFactory", + "org.camunda.bpm.engine.delegate.DelegateTask", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.model.bpmn.BpmnModelInstance", + "org.camunda.bpm.engine.delegate.VariableScope", + "org.camunda.bpm.engine.ProcessEngine", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.interceptor.CommandContext", + "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.camunda.bpm.engine.BadUserRequestException", + "org.camunda.bpm.engine.impl.context.ExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.ProcessEngineServices", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.runtime.Execution", + "org.camunda.bpm.engine.impl.pvm.process.Lane", + "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", + "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", + "org.camunda.bpm.engine.ProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", + "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", + "org.camunda.bpm.engine.delegate.BaseDelegateExecution", + "org.camunda.bpm.engine.impl.pvm.PvmExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope", + "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", + "org.camunda.bpm.engine.runtime.VariableInstance", + "org.camunda.bpm.engine.runtime.Job", + "org.camunda.bpm.engine.runtime.Incident", + "org.camunda.bpm.model.xml.ModelInstance", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", + "org.openecomp.mso.entity.MsoRequest", + "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", + "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", + "org.camunda.bpm.engine.impl.task.TaskDecorator", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStackNotifyListenerStart", + "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", + "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationsTransitionInterruptFlowScope", + "org.camunda.bpm.model.xml.instance.ModelElementInstance", + "org.camunda.bpm.engine.ProcessEngineException", + "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", + "org.camunda.bpm.engine.impl.db.DbEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerEnd", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireActivityEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationStartTransitionNotifyListenerTake", + "org.camunda.bpm.engine.runtime.EventSubscription", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", + "org.camunda.bpm.engine.management.JobDefinition", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "com.att.eelf.configuration.EELFLogger$Level", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", + "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", + "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", + "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", + "com.att.eelf.configuration.EELFLogger", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", + "org.camunda.bpm.engine.runtime.CaseInstance", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", + "org.openecomp.mso.bpmn.core.ReadConfigTask", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", + "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", + "org.camunda.bpm.engine.variable.value.TypedValue", + "org.apache.ibatis.transaction.TransactionFactory", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", + "org.camunda.bpm.engine.impl.pvm.process.LaneSet", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStack", + "org.camunda.bpm.engine.delegate.DelegateListener", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", + "org.camunda.bpm.engine.delegate.ExecutionListener", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd", + "org.camunda.bpm.engine.exception.NotAllowedException", + "org.camunda.bpm.engine.impl.history.event.HistoryEventType", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", + "com.att.eelf.configuration.SLF4jWrapper", + "org.camunda.bpm.engine.task.Task", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade", + "org.camunda.bpm.engine.impl.context.CoreExecutionContext", + "org.camunda.bpm.engine.delegate.DelegateVariableInstance", + "org.openecomp.mso.logger.MsoLogger", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.engine.variable.VariableMap", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", + "org.camunda.bpm.model.bpmn.instance.BaseElement", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateConcurrentExecution", + "org.camunda.bpm.engine.exception.NullValueException", + "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", + "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", + "org.openecomp.mso.bpmn.core.BaseTask", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartInterruptEventScope", + "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCancelScope", + "org.apache.ibatis.session.SqlSessionFactory", + "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", + "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", + "com.att.eelf.i18n.EELFResourceManager", + "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", + "org.openecomp.mso.logger.MessageEnum", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.camunda.bpm.engine.SuspendedEntityInteractionException", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCancelActivity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.camunda.bpm.engine.impl.db.HasDbReferences", + "org.camunda.bpm.engine.impl.tree.Collector", + "com.att.eelf.configuration.EELFManager", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", + "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.PvmTransition", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.model.cmmn.instance.CmmnElement", + "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", + "org.camunda.bpm.engine.variable.type.PrimitiveValueType", + "org.camunda.bpm.engine.delegate.VariableListener", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ReadConfigTaskESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "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.logger.MessageEnum", + "org.openecomp.mso.bpmn.core.ReadConfigTask", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.ProcessEngineException", + "org.camunda.bpm.engine.exception.NullValueException", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java new file mode 100644 index 0000000000..741872af7a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java @@ -0,0 +1,58 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:30:51 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +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 ReadFileTaskESTest extends ReadFileTaskESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ReadFileTask readFileTask0 = new ReadFileTask(); + ExecutionImpl executionImpl0 = new ExecutionImpl(); + Expression expression0 = mock(Expression.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(expression0).getValue(any(org.camunda.bpm.engine.delegate.VariableScope.class)); + PrivateAccess.setVariable((Class) ReadFileTask.class, readFileTask0, "inputVariable", (Object) expression0); + try { + readFileTask0.execute(executionImpl0); + fail("Expecting exception: RuntimeException"); + + } catch(RuntimeException e) { + // + // ReadFileTask injected field 'inputVariable' is bad: required field has null value + // + verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); + } + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ReadFileTask readFileTask0 = new ReadFileTask(); + ExecutionImpl executionImpl0 = new ExecutionImpl(); + try { + readFileTask0.execute(executionImpl0); + fail("Expecting exception: RuntimeException"); + + } catch(RuntimeException e) { + // + // ReadFileTask injected field 'inputVariable' is bad: missing required field + // + verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java new file mode 100644 index 0000000000..4b11c761cc --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java @@ -0,0 +1,339 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:30:51 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 ReadFileTaskESTestscaffolding { + + @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.bpmn.core.ReadFileTask"; + 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(ReadFileTaskESTestscaffolding.class.getClassLoader() , + "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.context.CaseExecutionContext", + "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", + "org.camunda.bpm.engine.impl.pvm.PvmScope", + "org.camunda.bpm.engine.delegate.JavaDelegate", + "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", + "org.camunda.bpm.engine.runtime.ProcessInstance", + "org.camunda.bpm.application.ProcessApplicationReference", + "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", + "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", + "org.openecomp.mso.bpmn.core.ReadFileTask", + "org.camunda.bpm.engine.delegate.DelegateExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", + "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", + "com.att.eelf.i18n.EELFMsgs", + "org.camunda.bpm.engine.impl.javax.el.ELContext", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceStart", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", + "org.camunda.bpm.engine.variable.type.ValueType", + "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", + "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationInterruptScope", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", + "org.camunda.bpm.engine.impl.db.HasDbRevision", + "org.camunda.bpm.model.bpmn.instance.FlowElement", + "org.camunda.bpm.engine.delegate.Expression", + "org.camunda.bpm.engine.variable.type.SerializableValueType", + "org.camunda.bpm.engine.impl.pvm.PvmActivity", + "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", + "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", + "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.application.ProcessApplicationUnavailableException", + "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", + "org.camunda.bpm.engine.delegate.DelegateCaseExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerTake", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", + "org.camunda.bpm.engine.runtime.CaseExecution", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", + "org.camunda.bpm.engine.repository.ProcessDefinition", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartConcurrent", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake", + "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", + "org.camunda.bpm.engine.impl.interceptor.SessionFactory", + "org.camunda.bpm.engine.delegate.DelegateTask", + "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.model.bpmn.BpmnModelInstance", + "org.camunda.bpm.engine.delegate.VariableScope", + "org.camunda.bpm.engine.ProcessEngine", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.interceptor.CommandContext", + "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.camunda.bpm.engine.BadUserRequestException", + "org.camunda.bpm.engine.impl.context.ExecutionContext", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.ProcessEngineServices", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.runtime.Execution", + "org.camunda.bpm.engine.impl.pvm.process.Lane", + "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", + "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", + "org.camunda.bpm.engine.ProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.util.BitMaskUtil", + "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", + "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", + "org.camunda.bpm.engine.delegate.BaseDelegateExecution", + "org.camunda.bpm.engine.impl.pvm.PvmExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope", + "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", + "org.camunda.bpm.engine.runtime.VariableInstance", + "org.camunda.bpm.engine.runtime.Job", + "org.camunda.bpm.engine.runtime.Incident", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState$CaseExecutionStateImpl", + "org.camunda.bpm.model.xml.ModelInstance", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", + "org.openecomp.mso.entity.MsoRequest", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", + "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", + "org.camunda.bpm.engine.impl.task.TaskDecorator", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStackNotifyListenerStart", + "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", + "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationsTransitionInterruptFlowScope", + "org.camunda.bpm.model.xml.instance.ModelElementInstance", + "org.camunda.bpm.engine.ProcessEngineException", + "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", + "org.camunda.bpm.engine.impl.db.DbEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerEnd", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireActivityEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationStartTransitionNotifyListenerTake", + "org.camunda.bpm.engine.runtime.EventSubscription", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", + "org.camunda.bpm.engine.management.JobDefinition", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "com.att.eelf.configuration.EELFLogger$Level", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", + "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", + "org.camunda.bpm.engine.impl.javax.el.ValueReference", + "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", + "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", + "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "com.att.eelf.configuration.EELFLogger", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", + "org.camunda.bpm.engine.runtime.CaseInstance", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", + "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseSentryPartImpl", + "org.camunda.bpm.engine.variable.value.TypedValue", + "org.apache.ibatis.transaction.TransactionFactory", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", + "org.camunda.bpm.engine.impl.pvm.process.LaneSet", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStack", + "org.camunda.bpm.engine.delegate.DelegateListener", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", + "org.camunda.bpm.engine.delegate.ExecutionListener", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd", + "org.camunda.bpm.engine.exception.NotAllowedException", + "org.camunda.bpm.engine.impl.history.event.HistoryEventType", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", + "com.att.eelf.configuration.SLF4jWrapper", + "org.camunda.bpm.engine.task.Task", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade", + "org.camunda.bpm.engine.impl.context.CoreExecutionContext", + "org.camunda.bpm.engine.delegate.DelegateVariableInstance", + "org.openecomp.mso.logger.MsoLogger", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.model.cmmn.CmmnModelInstance", + "org.camunda.bpm.engine.variable.VariableMap", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", + "org.camunda.bpm.model.bpmn.instance.BaseElement", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateConcurrentExecution", + "org.camunda.bpm.engine.exception.NullValueException", + "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", + "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", + "org.openecomp.mso.bpmn.core.BaseTask", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartInterruptEventScope", + "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCancelScope", + "org.apache.ibatis.session.SqlSessionFactory", + "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", + "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", + "com.att.eelf.i18n.EELFResourceManager", + "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", + "org.openecomp.mso.logger.MessageEnum", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.camunda.bpm.engine.SuspendedEntityInteractionException", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCancelActivity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.camunda.bpm.engine.impl.db.HasDbReferences", + "org.camunda.bpm.engine.impl.tree.Collector", + "com.att.eelf.configuration.EELFManager", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", + "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.PvmTransition", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.model.cmmn.instance.CmmnElement", + "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", + "org.camunda.bpm.engine.variable.type.PrimitiveValueType", + "org.camunda.bpm.engine.delegate.VariableListener", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ReadFileTaskESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "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.logger.MessageEnum", + "org.openecomp.mso.bpmn.core.ReadFileTask", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.ProcessEngineException", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.exception.NullValueException", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", + "org.camunda.bpm.engine.impl.util.BitMaskUtil", + "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", + "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java new file mode 100644 index 0000000000..e26f5a9a46 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java @@ -0,0 +1,117 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:33:44 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +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 RollbackDataESTest extends RollbackDataESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("", "", ""); + String string0 = (String)rollbackData0.get("", "0-0|Ox?"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + Serializable serializable0 = rollbackData0.get("", "0-0|Ox?"); + assertNull(serializable0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("", "", ""); + String string0 = (String)rollbackData0.get("", ""); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + HashMap hashMap0 = new HashMap(); + HashMap hashMap1 = new HashMap(); + hashMap0.put("/0H\"wnR=^l|l$+qQDi", hashMap1); + PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) hashMap0); + Map map0 = rollbackData0.get("/0H\"wnR=^l|l$+qQDi"); + assertEquals(0, map0.size()); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("RollbackData[]", "$", "RollbackData[]"); + Map map0 = rollbackData0.get("RollbackData[]"); + assertFalse(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("org.openecomp.mso.bpmn.core.RollbackData", "org.openecomp.mso.bpmn.core.RollbackData", "!{=|?cluq? yk])."); + rollbackData0.get(""); + PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) null); + // Undeclared exception! + try { + rollbackData0.get("org.openecomp.mso.bpmn.core.RollbackData"); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.bpmn.core.RollbackData", e); + } + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("$", "$", "RollbackData[]"); + rollbackData0.put("RollbackData[]", "$", "RollbackData[]"); + String string0 = rollbackData0.toString(); + assertEquals("RollbackData[${$=RollbackData[]},RollbackData[]{$=RollbackData[]}]", string0); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + rollbackData0.put("$", "$", "RollbackData[]"); + rollbackData0.put("$", "RollbackData[]", "RollbackData[]"); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + HashMap hashMap0 = new HashMap(); + HashMap hashMap1 = new HashMap(); + hashMap0.put("/0H\"wnR=^l|l$+qQDi", hashMap1); + PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) hashMap0); + boolean boolean0 = rollbackData0.hasType("/0H\"wnR=^l|l$+qQDi"); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + RollbackData rollbackData0 = new RollbackData(); + boolean boolean0 = rollbackData0.hasType("RollbackData[]"); + assertFalse(boolean0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java new file mode 100644 index 0000000000..7dc6ca1e4e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:33:44 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 RollbackDataESTestscaffolding { + + @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.bpmn.core.RollbackData"; + 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(RollbackDataESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.bpmn.core.RollbackData" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RollbackDataESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.RollbackData" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java new file mode 100644 index 0000000000..3f2f74d2f7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java @@ -0,0 +1,262 @@ +/*- + * ============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.bpmn.core; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.openecomp.mso.bpmn.test.CamundaDBSetup; +import org.openecomp.mso.bpmn.test.PropertyConfigurationSetup; +import org.openecomp.mso.logger.MsoLogger; + +/** + * Unit test for BaseTask class. + */ +public class TestBaseTask { + + @Rule + public ProcessEngineRule processEngineRule = new ProcessEngineRule(); + + @Before + public void beforeTest() throws Exception { + CamundaDBSetup.configure(); + PropertyConfigurationSetup.init(); + } + + @Test + @Deployment(resources={"BaseTaskTest.bpmn"}) + public void shouldInvokeService() { + Map variables = new HashMap(); + variables.put("firstName", "Jane"); + variables.put("lastName", "Doe"); + variables.put("age", (Integer)25); + variables.put("lastVisit", (Long)1438270117000L); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + processEngineRule.getTaskService(); + runtimeService.startProcessInstanceByKey("BaseTaskTest", variables); + } + + /** + * Unit test code for BaseTask. + */ + public static class TestTask extends BaseTask { + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + + private Expression existingString; + private Expression nonExistingString; + private Expression existingStringFromVar; + private Expression nonExistingStringFromVar; + + private Expression existingInteger; + private Expression nonExistingInteger; + private Expression existingIntegerFromVar; + private Expression nonExistingIntegerFromVar; + + private Expression existingLong; + private Expression nonExistingLong; + private Expression existingLongFromVar; + private Expression nonExistingLongFromVar; + + private Expression existingOutputVar; + private Expression nonExistingOutputVar; + private Expression existingBadOutputVar; + + public void execute(DelegateExecution execution) throws Exception { + msoLogger.debug("Started executing " + getClass().getSimpleName()); + + /*********************************************************************/ + msoLogger.debug("Running String Field Tests"); + /*********************************************************************/ + + String s = getStringField(existingString, execution, "existingString"); + Assert.assertEquals("Hello World", s); + + try { + s = getStringField(nonExistingString, execution, "nonExistingString"); + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } + } + + s = getOptionalStringField(existingString, execution, "existingString"); + Assert.assertEquals("Hello World", s); + + s = getOptionalStringField(nonExistingString, execution, "nonExistingString"); + Assert.assertEquals(null, s); + + /*********************************************************************/ + msoLogger.debug("Running String Expression Tests"); + /*********************************************************************/ + + s = getStringField(existingStringFromVar, execution, "existingStringFromVar"); + Assert.assertEquals("Jane", s); + + try { + s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar"); + } + } + + s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar"); + Assert.assertEquals("Jane", s); + + s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar"); + Assert.assertEquals(null, s); + + /*********************************************************************/ + msoLogger.debug("Running Integer Field Tests"); + /*********************************************************************/ + + Integer i = getIntegerField(existingInteger, execution, "existingInteger"); + Assert.assertEquals((Integer)42, i); + + try { + i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger"); + Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); + } + } + + i = getOptionalIntegerField(existingInteger, execution, "existingInteger"); + Assert.assertEquals((Integer)42, i); + + i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger"); + Assert.assertEquals(null, i); + + /*********************************************************************/ + msoLogger.debug("Running Integer Expression Tests"); + /*********************************************************************/ + + i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); + Assert.assertEquals((Integer)25, i); + + try { + i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); + Assert.fail("Expected BadInjectedFieldException for nonExistingInteger"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar"); + } + } + + i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar"); + Assert.assertEquals((Integer)25, i); + + i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar"); + Assert.assertEquals(null, i); + + /*********************************************************************/ + msoLogger.debug("Running Long Field Tests"); + /*********************************************************************/ + + Long l = getLongField(existingLong, execution, "existingLong"); + Assert.assertEquals((Long)123456789L, l); + + try { + l = getLongField(nonExistingLong, execution, "nonExistingLong"); + Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); + } + } + + l = getOptionalLongField(existingLong, execution, "existingLong"); + Assert.assertEquals((Long)123456789L, l); + + l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong"); + Assert.assertEquals(null, l); + + /*********************************************************************/ + msoLogger.debug("Running Long Expression Tests"); + /*********************************************************************/ + + l = getLongField(existingLongFromVar, execution, "existingLongFromVar"); + Assert.assertEquals((Long)1438270117000L, l); + + try { + l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); + Assert.fail("Expected BadInjectedFieldException for nonExistingLong"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar"); + } + } + + l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar"); + Assert.assertEquals((Long)1438270117000L, l); + + l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar"); + Assert.assertEquals(null, i); + + /*********************************************************************/ + msoLogger.debug("Running Output Variable Field Tests"); + /*********************************************************************/ + + String var = getOutputField(existingOutputVar, execution, "existingOutputVar"); + Assert.assertEquals("goodVariable", var); + + try { + var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } + } + + var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar"); + Assert.assertEquals("goodVariable", var); + + var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar"); + Assert.assertEquals(null, var); + + try { + var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar"); + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } catch (Exception e) { + if (!(e instanceof BadInjectedFieldException)) { + Assert.fail("Expected BadInjectedFieldException for nonExistingString"); + } + } + + msoLogger.debug("Finished executing " + getClass().getSimpleName()); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java new file mode 100644 index 0000000000..64220f016d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java @@ -0,0 +1,27 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:35:51 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; + +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +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 URNMappingsTaskESTest extends URNMappingsTaskESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + URNMappingsTask uRNMappingsTask0 = new URNMappingsTask(); + DelegateExecution delegateExecution0 = mock(DelegateExecution.class, new ViolatedAssumptionAnswer()); + uRNMappingsTask0.execute(delegateExecution0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java new file mode 100644 index 0000000000..93151d3271 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java @@ -0,0 +1,103 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:35:51 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 URNMappingsTaskESTestscaffolding { + + @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.bpmn.core.URNMappingsTask"; + 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(URNMappingsTaskESTestscaffolding.class.getClassLoader() , + "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", + "org.camunda.bpm.model.xml.instance.ModelElementInstance", + "org.camunda.bpm.engine.delegate.VariableScope", + "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", + "org.camunda.bpm.engine.variable.value.TypedValue", + "org.camunda.bpm.engine.delegate.DelegateExecution", + "org.camunda.bpm.engine.delegate.Expression", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", + "org.openecomp.mso.bpmn.core.URNMappingsTask", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "org.openecomp.mso.bpmn.core.BaseTask", + "org.camunda.bpm.engine.delegate.BaseDelegateExecution", + "org.camunda.bpm.engine.variable.VariableMap", + "org.camunda.bpm.engine.delegate.JavaDelegate", + "org.camunda.bpm.engine.ProcessEngineServices", + "org.camunda.bpm.model.bpmn.BpmnModelInstance", + "org.camunda.bpm.model.bpmn.instance.BaseElement", + "org.camunda.bpm.model.xml.ModelInstance", + "org.camunda.bpm.model.bpmn.instance.FlowElement" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(URNMappingsTaskESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java new file mode 100644 index 0000000000..1891c8d478 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java @@ -0,0 +1,88 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:35:37 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 WorkflowExceptionESTest extends WorkflowExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + WorkflowException workflowException0 = new WorkflowException("(YdK~.N3;c2C", 336, "(YdK~.N3;c2C"); + workflowException0.getProcessKey(); + assertEquals(336, workflowException0.getErrorCode()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + WorkflowException workflowException0 = new WorkflowException("", 0, ""); + workflowException0.getProcessKey(); + assertEquals(0, workflowException0.getErrorCode()); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, 0, "^Y:"); + String string0 = workflowException0.getErrorMessage(); + assertEquals(0, workflowException0.getErrorCode()); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + WorkflowException workflowException0 = new WorkflowException("", 1216, ""); + workflowException0.getErrorMessage(); + assertEquals(1216, workflowException0.getErrorCode()); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + WorkflowException workflowException0 = new WorkflowException("", 0, ""); + int int0 = workflowException0.getErrorCode(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, (-1911), (String) null); + int int0 = workflowException0.getErrorCode(); + assertEquals((-1911), int0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); + workflowException0.getErrorMessage(); + assertEquals(336, workflowException0.getErrorCode()); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); + int int0 = workflowException0.getErrorCode(); + assertEquals(336, int0); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); + workflowException0.getProcessKey(); + assertEquals(336, workflowException0.getErrorCode()); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); + String string0 = workflowException0.toString(); + assertEquals("WorkflowException[processKey=null,errorCode=336,errorMessage=null]", string0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java new file mode 100644 index 0000000000..88e0e0f96f --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:35:37 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 WorkflowExceptionESTestscaffolding { + + @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.bpmn.core.WorkflowException"; + 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(WorkflowExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.bpmn.core.WorkflowException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(WorkflowExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.WorkflowException" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java new file mode 100644 index 0000000000..a14934193e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java @@ -0,0 +1,81 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:28:14 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import java.io.IOException; +import net.sf.saxon.s9api.XQueryCompiler; +import net.sf.saxon.s9api.XQueryExecutable; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +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 XQueryScriptTaskESTest extends XQueryScriptTaskESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); + XQueryCompiler xQueryCompiler0 = mock(XQueryCompiler.class, new ViolatedAssumptionAnswer()); + doReturn((XQueryExecutable) null).when(xQueryCompiler0).compile(any(java.io.InputStream.class)); + Object object0 = PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) xQueryCompiler0, (Class) XQueryCompiler.class, (Object) "", (Class) String.class); + assertNull(object0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); + XQueryCompiler xQueryCompiler0 = mock(XQueryCompiler.class, new ViolatedAssumptionAnswer()); + try { + PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) xQueryCompiler0, (Class) XQueryCompiler.class, (Object) "Sk##N$V^.", (Class) String.class); + fail("Expecting exception: IOException"); + + } catch(IOException e) { + // + // Resource not found: Sk##N$V^. + // + verifyException("org.openecomp.mso.bpmn.core.XQueryScriptTask", e); + } + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); + try { + PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) null, (Class) XQueryCompiler.class, (Object) "", (Class) String.class); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.bpmn.core.XQueryScriptTask", e); + } + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); + ExecutionImpl executionImpl0 = new ExecutionImpl(); + try { + xQueryScriptTask0.execute(executionImpl0); + fail("Expecting exception: RuntimeException"); + + } catch(RuntimeException e) { + // + // XQueryScriptTask injected field 'scriptFile' is bad: missing required field + // + verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); + } + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java new file mode 100644 index 0000000000..b0c1585e59 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java @@ -0,0 +1,533 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:28:14 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core; + +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 XQueryScriptTaskESTestscaffolding { + + @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.bpmn.core.XQueryScriptTask"; + 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(XQueryScriptTaskESTestscaffolding.class.getClassLoader() , + "net.sf.saxon.pattern.PatternFinder", + "net.sf.saxon.pattern.AnyNodeTest", + "net.sf.saxon.tree.linked.TextImpl", + "net.sf.saxon.tree.linked.ElementImpl", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", + "org.camunda.bpm.engine.impl.context.CaseExecutionContext", + "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", + "org.camunda.bpm.engine.impl.pvm.PvmScope", + "net.sf.saxon.type.TypeHierarchy", + "net.sf.saxon.trans.Mode", + "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", + "org.camunda.bpm.engine.runtime.ProcessInstance", + "net.sf.saxon.trans.CompilerInfo", + "net.sf.saxon.type.ConversionResult", + "net.sf.saxon.type.ItemType", + "net.sf.saxon.om.NamePool", + "net.sf.saxon.value.NumericValue", + "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", + "net.sf.saxon.s9api.Processor", + "net.sf.saxon.om.NameChecker", + "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", + "net.sf.saxon.expr.sort.SimpleCollation", + "net.sf.saxon.z.IntIterator", + "net.sf.saxon.expr.PendingUpdateList", + "net.sf.saxon.om.NamespaceBinding", + "net.sf.saxon.lib.StaticQueryContextFactory", + "net.sf.saxon.serialize.charcode.CharacterSet", + "net.sf.saxon.event.Receiver", + "org.camunda.bpm.model.bpmn.instance.FlowElement", + "net.sf.saxon.om.AbstractItem", + "net.sf.saxon.lib.ExternalObjectModel", + "net.sf.saxon.event.LocationProvider", + "org.camunda.bpm.engine.delegate.Expression", + "net.sf.saxon.value.QualifiedNameValue", + "net.sf.saxon.om.MutableDocumentInfo", + "org.camunda.bpm.engine.impl.pvm.PvmActivity", + "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", + "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", + "net.sf.saxon.pattern.NodeTest", + "net.sf.saxon.om.NamespaceException", + "net.sf.saxon.lib.EnvironmentVariableResolver", + "org.camunda.bpm.application.ProcessApplicationUnavailableException", + "net.sf.saxon.expr.instruct.Procedure", + "net.sf.saxon.om.Sequence", + "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", + "net.sf.saxon.type.ValidationFailure", + "org.camunda.bpm.engine.delegate.DelegateCaseExecution", + "net.sf.saxon.tree.iter.UnfailingIterator", + "net.sf.saxon.type.AnySimpleType", + "org.camunda.bpm.engine.runtime.CaseExecution", + "net.sf.saxon.event.ProxyReceiver", + "net.sf.saxon.lib.ConversionRules", + "net.sf.saxon.lib.OutputURIResolver", + "net.sf.saxon.expr.instruct.ValidatingInstruction", + "net.sf.saxon.om.FunctionItem", + "net.sf.saxon.om.MutableNodeInfo", + "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", + "net.sf.saxon.pattern.PatternWithPredicate", + "net.sf.saxon.expr.ErrorExpression", + "net.sf.saxon.om.Name10Checker", + "net.sf.saxon.event.ComplexContentOutputter", + "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", + "org.camunda.bpm.engine.delegate.DelegateTask", + "net.sf.saxon.style.LiteralResultElement", + "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", + "org.camunda.bpm.engine.impl.core.model.CoreActivity", + "net.sf.saxon.tree.iter.LookaheadIterator", + "net.sf.saxon.om.AtomicSequence", + "net.sf.saxon.s9api.XQueryCompiler", + "net.sf.saxon.pattern.LocalNameTest", + "net.sf.saxon.pattern.PatternParser", + "net.sf.saxon.expr.instruct.SlotManager", + "net.sf.saxon.PreparedStylesheet", + "org.camunda.bpm.engine.impl.interceptor.CommandContext", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "net.sf.saxon.lib.ParseOptions", + "net.sf.saxon.expr.ItemMappingIterator", + "net.sf.saxon.tree.iter.EmptyIterator", + "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", + "org.camunda.bpm.engine.impl.context.Context", + "net.sf.saxon.lib.LocalizerFactory", + "org.camunda.bpm.engine.ProcessEngineServices", + "org.camunda.bpm.engine.runtime.Execution", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", + "net.sf.saxon.s9api.ItemType$1", + "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", + "org.camunda.bpm.engine.ProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", + "net.sf.saxon.s9api.ItemType$2", + "net.sf.saxon.s9api.ItemType$3", + "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", + "net.sf.saxon.pattern.NodeKindTest", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", + "net.sf.saxon.expr.LetExpression", + "org.camunda.bpm.engine.delegate.BaseDelegateExecution", + "net.sf.saxon.s9api.XdmItem", + "net.sf.saxon.expr.Binding", + "net.sf.saxon.expr.instruct.ParentNodeConstructor", + "org.camunda.bpm.engine.runtime.VariableInstance", + "org.camunda.bpm.engine.runtime.Incident", + "net.sf.saxon.om.NamespaceResolver", + "net.sf.saxon.expr.instruct.AnalyzeString", + "net.sf.saxon.z.IntHashMap", + "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", + "net.sf.saxon.expr.instruct.ResultDocument", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", + "net.sf.saxon.type.StringToDouble", + "net.sf.saxon.value.SequenceType", + "net.sf.saxon.type.ComplexType", + "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", + "net.sf.saxon.type.AnyType", + "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", + "net.sf.saxon.expr.StaticContext", + "org.camunda.bpm.engine.ProcessEngineException", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", + "net.sf.saxon.lib.SerializerFactory", + "net.sf.saxon.tree.util.SteppingNode", + "net.sf.saxon.functions.IntegratedFunctionLibrary", + "net.sf.saxon.evpull.PullEvent", + "net.sf.saxon.expr.XPathContextMinor", + "org.camunda.bpm.engine.management.JobDefinition", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "net.sf.saxon.om.DocumentInfo", + "net.sf.saxon.om.QNameException", + "org.camunda.bpm.engine.impl.javax.el.ValueReference", + "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", + "net.sf.saxon.type.SchemaComponentVisitor", + "net.sf.saxon.z.AbstractIntSet", + "net.sf.saxon.tree.iter.AxisIterator", + "net.sf.saxon.s9api.XdmValue", + "net.sf.saxon.lib.CollationURIResolver", + "org.openecomp.mso.bpmn.core.XQueryScriptTask", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", + "net.sf.saxon.tree.tiny.AppendableCharSequence", + "net.sf.saxon.om.GroundedValue", + "net.sf.saxon.tree.linked.NodeFactory", + "net.sf.saxon.type.SchemaDeclaration", + "net.sf.saxon.tree.linked.CommentImpl", + "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", + "org.camunda.bpm.engine.variable.value.TypedValue", + "net.sf.saxon.trans.BuiltInRuleSet", + "org.apache.ibatis.transaction.TransactionFactory", + "net.sf.saxon.value.AtomicValue", + "net.sf.saxon.trans.NonDelegatingURIResolver", + "net.sf.saxon.functions.VendorFunctionLibrary", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", + "net.sf.saxon.pattern.PatternParser20", + "net.sf.saxon.expr.instruct.TraceExpression", + "org.camunda.bpm.engine.exception.NotAllowedException", + "net.sf.saxon.Configuration", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "net.sf.saxon.tree.util.FastStringBuffer", + "net.sf.saxon.tree.linked.NodeImpl", + "com.att.eelf.configuration.SLF4jWrapper", + "org.camunda.bpm.engine.task.Task", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "net.sf.saxon.type.Type", + "net.sf.saxon.s9api.XdmNode", + "net.sf.saxon.value.QNameValue", + "org.camunda.bpm.engine.impl.context.CoreExecutionContext", + "org.openecomp.mso.logger.MsoLogger", + "net.sf.saxon.type.SchemaType", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "net.sf.saxon.java.JavaPlatform$1", + "net.sf.saxon.expr.instruct.ElementCreator", + "net.sf.saxon.om.Item", + "org.camunda.bpm.engine.variable.VariableMap", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", + "net.sf.saxon.lib.SchemaURIResolver", + "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", + "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", + "net.sf.saxon.lib.ModuleURIResolver", + "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", + "net.sf.saxon.expr.parser.ExpressionVisitor", + "net.sf.saxon.om.SequenceIterator", + "net.sf.saxon.z.IntHashSet", + "net.sf.saxon.type.BuiltInType", + "org.apache.ibatis.session.SqlSessionFactory", + "net.sf.saxon.expr.instruct.Executable", + "net.sf.saxon.om.DocumentPool", + "net.sf.saxon.expr.LastPositionFinder", + "net.sf.saxon.expr.instruct.TailCallReturner", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "net.sf.saxon.type.BuiltInAtomicType", + "org.camunda.bpm.engine.SuspendedEntityInteractionException", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.configuration.EELFManager", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", + "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", + "org.camunda.bpm.engine.impl.pvm.PvmTransition", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", + "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", + "net.sf.saxon.pattern.ContentTypeTest", + "net.sf.saxon.query.QueryParser", + "net.sf.saxon.om.NodeName", + "net.sf.saxon.value.Closure", + "net.sf.saxon.expr.instruct.FixedElement", + "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", + "net.sf.saxon.s9api.ConstructedItemType", + "net.sf.saxon.lib.Numberer", + "org.camunda.bpm.engine.delegate.JavaDelegate", + "net.sf.saxon.om.IdentityComparable", + "net.sf.saxon.z.IntSet", + "org.camunda.bpm.application.ProcessApplicationReference", + "net.sf.saxon.pattern.QNameTest", + "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", + "net.sf.saxon.expr.sort.SortKeyDefinition", + "net.sf.saxon.style.XSLAnalyzeString", + "org.camunda.bpm.engine.delegate.DelegateExecution", + "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", + "net.sf.saxon.expr.instruct.ValueOf", + "net.sf.saxon.type.AnyItemType", + "com.att.eelf.i18n.EELFMsgs", + "org.camunda.bpm.engine.impl.javax.el.ELContext", + "net.sf.saxon.expr.instruct.WithParam", + "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", + "net.sf.saxon.expr.Assignation", + "net.sf.saxon.value.StringToDouble11", + "org.camunda.bpm.engine.variable.type.ValueType", + "net.sf.saxon.style.StylesheetModule", + "net.sf.saxon.value.EmptySequence", + "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", + "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", + "net.sf.saxon.style.PrincipalStylesheetModule", + "net.sf.saxon.type.PlainType", + "org.camunda.bpm.engine.repository.CaseDefinition", + "org.camunda.bpm.engine.impl.db.HasDbRevision", + "net.sf.saxon.query.StaticQueryContext", + "net.sf.saxon.expr.instruct.SimpleNodeConstructor", + "net.sf.saxon.trans.DynamicLoader", + "net.sf.saxon.s9api.ItemType$BuiltInAtomicItemType", + "org.camunda.bpm.engine.variable.type.SerializableValueType", + "net.sf.saxon.event.SaxonLocator", + "net.sf.saxon.expr.parser.Optimizer", + "org.camunda.bpm.engine.impl.pvm.PvmException", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "net.sf.saxon.expr.sort.Sortable", + "net.sf.saxon.type.ExternalObjectType", + "net.sf.saxon.expr.Literal", + "net.sf.saxon.style.StyleElement", + "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", + "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", + "net.sf.saxon.type.ValidationException", + "org.camunda.bpm.engine.repository.ProcessDefinition", + "net.sf.saxon.style.AbsentExtensionElement", + "net.sf.saxon.style.XSLStylesheet", + "net.sf.saxon.query.XQueryFunctionBinder", + "net.sf.saxon.Platform", + "net.sf.saxon.om.AbsolutePath", + "net.sf.saxon.style.SourceBinding", + "org.camunda.bpm.engine.impl.interceptor.SessionFactory", + "net.sf.saxon.trace.InstructionInfo", + "net.sf.saxon.pattern.NameTest", + "net.sf.saxon.trans.XPathException", + "net.sf.saxon.pattern.ItemTypePattern", + "org.camunda.bpm.model.bpmn.BpmnModelInstance", + "net.sf.saxon.type.SimpleType", + "net.sf.saxon.tree.linked.ProcInstImpl", + "net.sf.saxon.expr.instruct.UserFunction", + "net.sf.saxon.event.SequenceReceiver", + "org.camunda.bpm.engine.delegate.VariableScope", + "net.sf.saxon.event.FilterFactory", + "org.camunda.bpm.engine.ProcessEngine", + "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", + "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", + "org.camunda.bpm.engine.BadUserRequestException", + "net.sf.saxon.expr.Callable", + "org.camunda.bpm.engine.impl.context.ExecutionContext", + "net.sf.saxon.tree.tiny.TinyTree", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "net.sf.saxon.tree.iter.EmptyAxisIterator", + "net.sf.saxon.om.NotationSet", + "net.sf.saxon.expr.CollationMap", + "net.sf.saxon.tree.util.AttributeCollectionImpl", + "net.sf.saxon.type.UnionType", + "net.sf.saxon.expr.instruct.GeneralVariable", + "net.sf.saxon.trans.LicenseException", + "org.camunda.bpm.engine.impl.pvm.PvmExecution", + "net.sf.saxon.functions.FunctionLibrary", + "net.sf.saxon.lib.StandardURIResolver", + "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", + "net.sf.saxon.type.TypeHierarchy$2", + "net.sf.saxon.trans.Mode$RuleAction", + "org.camunda.bpm.engine.runtime.Job", + "net.sf.saxon.type.TypeHierarchy$1", + "org.camunda.bpm.model.xml.ModelInstance", + "net.sf.saxon.om.FingerprintedNode", + "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", + "net.sf.saxon.tree.linked.ParentNodeImpl", + "net.sf.saxon.type.ErrorType", + "org.openecomp.mso.entity.MsoRequest", + "net.sf.saxon.value.NotationValue", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "net.sf.saxon.s9api.ItemType", + "net.sf.saxon.type.Untyped", + "net.sf.saxon.expr.parser.PathMap$PathMapRoot", + "net.sf.saxon.expr.instruct.AttributeCreator", + "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", + "net.sf.saxon.expr.instruct.AttributeSet", + "net.sf.saxon.trans.Mode$RuleFilter", + "net.sf.saxon.s9api.XdmAtomicValue", + "net.sf.saxon.om.AttributeCollection", + "org.camunda.bpm.model.xml.instance.ModelElementInstance", + "net.sf.saxon.expr.sort.RuleBasedSubstringMatcher", + "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", + "org.camunda.bpm.engine.impl.db.DbEntity", + "net.sf.saxon.java.JavaPlatform", + "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", + "org.camunda.bpm.engine.runtime.EventSubscription", + "net.sf.saxon.lib.URIChecker", + "net.sf.saxon.tree.linked.DocumentImpl", + "net.sf.saxon.s9api.XQueryExecutable", + "net.sf.saxon.expr.instruct.FixedAttribute", + "net.sf.saxon.expr.XPathContextMajor", + "net.sf.saxon.type.AtomicType", + "net.sf.saxon.expr.instruct.DocumentInstr", + "net.sf.saxon.expr.Expression", + "net.sf.saxon.serialize.charcode.CharacterSetFactory", + "com.att.eelf.configuration.EELFLogger$Level", + "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", + "net.sf.saxon.tree.util.Navigator", + "net.sf.saxon.pattern.NamespaceTest", + "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", + "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", + "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "net.sf.saxon.tree.iter.ReversibleIterator", + "com.att.eelf.configuration.EELFLogger", + "net.sf.saxon.event.Builder", + "org.camunda.bpm.engine.runtime.CaseInstance", + "net.sf.saxon.s9api.SaxonApiException", + "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", + "net.sf.saxon.om.StructuredQName", + "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", + "org.camunda.bpm.engine.impl.core.model.CoreModelElement", + "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", + "net.sf.saxon.style.StyleNodeFactory", + "net.sf.saxon.expr.instruct.Instruction", + "net.sf.saxon.functions.FunctionLibraryList", + "org.camunda.bpm.engine.delegate.DelegateListener", + "net.sf.saxon.event.TeeOutputter", + "net.sf.saxon.lib.CollectionURIResolver", + "net.sf.saxon.type.SchemaException", + "net.sf.saxon.serialize.CDATAFilter", + "net.sf.saxon.lib.StringCollator", + "net.sf.saxon.expr.XPathContext", + "net.sf.saxon.lib.SourceResolver", + "net.sf.saxon.expr.MappingFunction", + "net.sf.saxon.expr.Container", + "net.sf.saxon.type.SchemaComponent", + "net.sf.saxon.om.Name11Checker", + "net.sf.saxon.expr.parser.ExpressionParser", + "org.camunda.bpm.engine.impl.history.event.HistoryEventType", + "net.sf.saxon.event.PipelineConfiguration", + "net.sf.saxon.tree.wrapper.SiblingCountingNode", + "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", + "net.sf.saxon.value.MemoClosure", + "net.sf.saxon.value.DecimalValue", + "org.camunda.bpm.engine.delegate.DelegateVariableInstance", + "net.sf.saxon.TypeCheckerEnvironment", + "net.sf.saxon.serialize.AttributeSorter", + "net.sf.saxon.regex.RegularExpression", + "net.sf.saxon.style.DataElement", + "net.sf.saxon.lib.ExtensionFunctionDefinition", + "net.sf.saxon.lib.SubstringMatcher", + "net.sf.saxon.lib.TraceListener", + "org.camunda.bpm.model.bpmn.instance.BaseElement", + "net.sf.saxon.style.Declaration", + "net.sf.saxon.value.BooleanValue", + "net.sf.saxon.expr.parser.CodeInjector", + "net.sf.saxon.tree.util.DocumentNumberAllocator", + "net.sf.saxon.pattern.PatternThatSetsCurrent", + "net.sf.saxon.expr.instruct.Debugger", + "org.openecomp.mso.bpmn.core.BaseTask", + "net.sf.saxon.pattern.Pattern", + "net.sf.saxon.expr.parser.PathMap$PathMapNode", + "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", + "net.sf.saxon.expr.instruct.SavedNamespaceContext", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", + "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", + "com.att.eelf.i18n.EELFResourceManager", + "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", + "net.sf.saxon.om.NodeInfo", + "net.sf.saxon.event.NamespaceReducer", + "org.openecomp.mso.logger.MessageEnum", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.camunda.bpm.engine.impl.db.HasDbReferences", + "org.camunda.bpm.engine.impl.tree.Collector", + "net.sf.saxon.expr.StringLiteral", + "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", + "net.sf.saxon.expr.ItemMappingFunction", + "net.sf.saxon.expr.instruct.UseAttributeSets", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "net.sf.saxon.tree.iter.GroundedIterator", + "org.camunda.bpm.engine.variable.type.PrimitiveValueType" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(XQueryScriptTaskESTestscaffolding.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", + "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.bpmn.core.XQueryScriptTask", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.camunda.bpm.engine.impl.javax.el.Expression", + "org.camunda.bpm.engine.impl.javax.el.ValueExpression", + "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", + "org.camunda.bpm.engine.impl.core.instance.CoreExecution", + "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", + "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", + "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", + "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", + "org.camunda.bpm.engine.impl.context.Context", + "org.camunda.bpm.engine.ProcessEngineException", + "org.openecomp.mso.bpmn.core.BadInjectedFieldException", + "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", + "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", + "net.sf.saxon.java.JavaPlatform", + "net.sf.saxon.Configuration", + "net.sf.saxon.tree.linked.NodeImpl", + "net.sf.saxon.style.StyleElement", + "net.sf.saxon.style.LiteralResultElement", + "net.sf.saxon.style.AbsentExtensionElement", + "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", + "net.sf.saxon.tree.iter.EmptyIterator", + "net.sf.saxon.tree.iter.EmptyAxisIterator", + "net.sf.saxon.style.XSLAnalyzeString", + "net.sf.saxon.tree.util.Navigator", + "net.sf.saxon.om.NamespaceBinding", + "net.sf.saxon.type.AnySimpleType", + "net.sf.saxon.pattern.NodeTest", + "net.sf.saxon.pattern.AnyNodeTest", + "net.sf.saxon.type.AnyItemType", + "net.sf.saxon.type.Type", + "net.sf.saxon.z.IntHashMap", + "net.sf.saxon.type.AnyType", + "net.sf.saxon.type.Untyped", + "net.sf.saxon.type.ErrorType", + "net.sf.saxon.type.BuiltInType", + "net.sf.saxon.type.BuiltInAtomicType", + "net.sf.saxon.value.BooleanValue" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java new file mode 100644 index 0000000000..fec405ef96 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java @@ -0,0 +1,165 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:28:11 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core.json; + +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.Iterator; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.json.JSONObject; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class JsonUtilsESTest extends JsonUtilsESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + String string0 = JsonUtils.updJsonValue((String) null, "#", "#"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + String string0 = JsonUtils.getJsonValueForKey((JSONObject) null, "LPZc4`q5w]IQMS.^'3"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + String string0 = JsonUtils.getJsonParamValue("", ":bnv,&jl3bK", ""); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + String string0 = JsonUtils.getJsonParamValue("", "", "tuw[9j$Sz"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + String string0 = JsonUtils.getJsonValue((String) null, ""); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + String string0 = JsonUtils.addJsonValue((String) null, (String) null, (String) null); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + String string0 = JsonUtils.xml2json("", (Boolean) null); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + String string0 = JsonUtils.xml2json((String) null); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + String string0 = JsonUtils.updJsonValue("tV a^wGCAwX", "tV a^wGCAwX", "tV a^wGCAwX"); + assertEquals("tV a^wGCAwX", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + String string0 = JsonUtils.updJsonValue("", "", ""); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Boolean boolean0 = Boolean.TRUE; + String string0 = JsonUtils.json2xml("", boolean0); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + String string0 = JsonUtils.getJsonValueForKey("java.io.StringWriter@0000000003", "#"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Iterator iterator0 = JsonUtils.getJsonIterator((String) null); + assertNull(iterator0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + String string0 = JsonUtils.delJsonValue("java.io.StringWriter@0000000003", "java.io.StringWriter@0000000003"); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + String string0 = JsonUtils.delJsonValue("", (String) null); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + Boolean boolean0 = new Boolean(true); + String string0 = JsonUtils.xml2json("Y~N~%]", boolean0); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + String string0 = JsonUtils.delJsonValue((String) null, "/Y"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + String string0 = JsonUtils.updJsonValue((String) null, (String) null, "/Y"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + String string0 = JsonUtils.addJsonValue("java.io.StringWriter@0000000006", "/Y", (String) null); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Boolean boolean0 = JsonUtils.jsonValueExists("getJsonValueForKey(): found value=", "/Y"); + String string0 = JsonUtils.xml2json("getJsonValueForKey(): found value=", boolean0); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + String string0 = JsonUtils.json2xml(")?Fx+Bu:)1&$EZEmzoV"); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + String string0 = JsonUtils.xml2json("java.io.StringWriter@0000000006"); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + Iterator iterator0 = JsonUtils.getJsonIterator("{+%2:*}4"); + assertNotNull(iterator0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + JsonUtils jsonUtils0 = new JsonUtils(); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java new file mode 100644 index 0000000000..6d05db0b80 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java @@ -0,0 +1,120 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:28:11 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core.json; + +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 JsonUtilsESTestscaffolding { + + @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.bpmn.core.json.JsonUtils"; + 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(JsonUtilsESTestscaffolding.class.getClassLoader() , + "org.json.JSONObject$Null", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "com.att.eelf.configuration.EELFLogger", + "org.json.JSONException", + "org.openecomp.mso.bpmn.core.xml.XmlTool", + "org.json.JSONObject", + "org.json.XML", + "com.att.eelf.configuration.SLF4jWrapper", + "com.att.eelf.i18n.EELFResourceManager", + "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.openecomp.mso.logger.MsoLogger$StatusCode", + "org.json.JSONTokener", + "org.openecomp.mso.bpmn.core.json.JsonUtils", + "com.att.eelf.configuration.EELFManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.configuration.EELFLogger$Level", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "com.att.eelf.i18n.EELFResourceManager$1", + "org.json.JSONArray", + "org.json.XMLTokener" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(JsonUtilsESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.bpmn.core.xml.XmlTool", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.json.JSONObject", + "org.json.XML", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "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.logger.MessageEnum", + "org.openecomp.mso.bpmn.core.json.JsonUtils", + "org.json.JSONException", + "org.json.XMLTokener" + ); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java new file mode 100644 index 0000000000..9c17caeaf4 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java @@ -0,0 +1,114 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 11:33:04 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core.mybatis; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +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 URNMappingESTest extends URNMappingESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + String string0 = URNMapping.createIdentifierFromURN("!`OYz|WztoeK|A&=&M"); + assertEquals("URN_OYz_WztoeK_A_M", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setValue("=F'A%"); + String string0 = uRNMapping0.getValue(); + assertEquals("=F'A%", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setValue(""); + String string0 = uRNMapping0.getValue(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setRev(""); + String string0 = uRNMapping0.getRev(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setName(""); + String string0 = uRNMapping0.getName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + // Undeclared exception! + try { + URNMapping.createIdentifierFromURN((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.bpmn.core.mybatis.URNMapping", e); + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + String string0 = URNMapping.createIdentifierFromURN("mfJ\"%euO;@S_Xm"); + assertEquals("URN_mfJ_euO_S_Xm", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setRev(":pMWjfl,zq_IA"); + String string0 = uRNMapping0.getRev(); + assertEquals(":pMWjfl,zq_IA", string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + String string0 = uRNMapping0.getName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + String string0 = uRNMapping0.getRev(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + String string0 = uRNMapping0.getValue(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + URNMapping uRNMapping0 = new URNMapping(); + uRNMapping0.setName("c<"); + String string0 = uRNMapping0.getName(); + assertEquals("c<", string0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java new file mode 100644 index 0000000000..183ea84b58 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 11:33:04 GMT 2016 + */ + +package org.openecomp.mso.bpmn.core.mybatis; + +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 URNMappingESTestscaffolding { + + @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.bpmn.core.mybatis.URNMapping"; + 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(URNMappingESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.bpmn.core.mybatis.URNMapping" + ); + } + + private static void resetClasses() { + } +} -- cgit 1.2.3-korg