From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [MSO-8] Update the maven dependency Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes. Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc Signed-off-by: xg353y --- bpmn/MSOCoreBPMN/pom.xml | 348 +++++++------ .../openecomp/mso/bpmn/core/CamundaDBSetup.java | 88 ++++ .../mso/bpmn/core/HealthCheckHandler.java | 144 ++++-- .../mso/bpmn/core/PropertyConfiguration.java | 24 +- .../mso/bpmn/core/PropertyConfigurationSetup.java | 295 +++++++++++ .../openecomp/mso/bpmn/core/XQueryScriptTask.java | 2 +- .../openecomp/mso/bpmn/core/json/JsonUtils.java | 439 ++++++++++++++++- .../core/plugins/LoggingAndURNMappingPlugin.java | 4 +- .../openecomp/mso/bpmn/test/CamundaDBSetup.java | 108 ----- .../mso/bpmn/test/PropertyConfigurationSetup.java | 315 ------------ bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml | 4 +- .../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 | 539 +++++++++++++-------- .../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 | 21 +- .../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 | 5 +- .../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 --- .../src/test/resources/BaseTaskTest.bpmn | 2 +- .../MSOCoreBPMN/src/test/resources/camunda.cfg.xml | 26 +- bpmn/MSOCoreBPMN/src/test/resources/request.json | 10 +- .../src/test/resources/requestArray.json | 54 +++ 42 files changed, 1515 insertions(+), 4022 deletions(-) create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java create mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java delete mode 100644 bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/requestArray.json (limited to 'bpmn/MSOCoreBPMN') diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 9decd590e3..bdc26713e9 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -1,181 +1,177 @@ - - org.openecomp.mso - bpmn - 1.1.0-SNAPSHOT - - 4.0.0 - org.openecomp.mso - MSOCoreBPMN - jar + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + org.openecomp.mso + bpmn + 1.1.0-SNAPSHOT + + 4.0.0 + org.openecomp.mso + MSOCoreBPMN + jar - - - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - - default-jar - package - - jar - - - - org/openecomp/mso/bpmn/test/** - - - - - - - test-utilities - package - - jar - - - test - - org/openecomp/mso/bpmn/test/** - - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + + test-compile + compile + + testCompile + + + false + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + tests-jar + package + + test-jar + + + false + + + + + + - - + - - - org.camunda.bpm - camunda-engine - provided - - - org.camunda.bpm - camunda-engine-rest - classes - - - - commons-fileupload - commons-fileupload - - - - - - commons-fileupload - commons-fileupload - 1.3.2 - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - junit - junit - test - - - org.mockito - mockito-all - 1.10.19 - test - - - - org.camunda.connect - camunda-connect-connectors-all - compile - - - org.camunda.template-engines - camunda-template-engines-freemarker - - - org.camunda.bpm - camunda-engine-plugin-spin - - - - org.camunda.spin - camunda-spin-dataformat-json-jackson - - - org.camunda.spin - camunda-spin-dataformat-xml-dom - - - org.camunda.bpm - camunda-engine-plugin-connect - - - org.codehaus.groovy - groovy-all - compile - - - com.h2database - h2 - provided - - - net.sf.saxon - Saxon-HE - - - org.openecomp.mso - common - ${project.version} - - - org.jboss.resteasy - resteasy-jaxrs - 3.0.19.Final - provided - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-simple - - - org.apache.httpcomponents - httpclient - - - - - org.json - json - 20160212 - - - xmlunit - xmlunit - 1.6 - - - + + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + + + org.camunda.bpm + camunda-engine + provided + + + org.camunda.bpm + camunda-engine-rest + classes + + + + commons-fileupload + commons-fileupload + + + + + + commons-fileupload + commons-fileupload + 1.3.2 + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + org.mockito + mockito-all + 1.10.19 + test + + + + org.camunda.connect + camunda-connect-connectors-all + compile + + + org.camunda.template-engines + camunda-template-engines-freemarker + + + org.camunda.bpm + camunda-engine-plugin-spin + + + + + org.camunda.spin + camunda-spin-dataformat-all + + + org.camunda.bpm + camunda-engine-plugin-connect + + + org.codehaus.groovy + groovy-all + compile + + + com.h2database + h2 + test + + + net.sf.saxon + Saxon-HE + + + org.openecomp.mso + common + ${project.version} + + + org.jboss.resteasy + resteasy-jaxrs + 3.0.19.Final + provided + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.apache.httpcomponents + httpclient + + + + + org.json + json + 20160212 + + + xmlunit + xmlunit + 1.6 + + + org.openecomp.mso + status-control + ${project.version} + + + \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java new file mode 100644 index 0000000000..aba43eb522 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java @@ -0,0 +1,88 @@ +package org.openecomp.mso.bpmn.core; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +/** + * Sets up the unit test (H2) database for Camunda. + */ +public class CamundaDBSetup { + private static boolean isDBConfigured = false; + + public static synchronized void configure() throws SQLException { + if (isDBConfigured) { + return; + } + + System.out.println("Configuring the Camunda H2 database for MSO"); + + Connection connection = null; + PreparedStatement stmt = null; + + try { + connection = DriverManager.getConnection( + "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", ""); + + stmt = connection.prepareStatement("delete from ACT_HI_VARINST"); + stmt.executeUpdate(); + stmt.close(); + stmt = null; + + stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob"); + stmt.executeUpdate(); + stmt.close(); + stmt = null; + +// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); +// stmt.executeUpdate(); +// stmt.close(); +// stmt = null; + + stmt = connection.prepareStatement("delete from ACT_HI_DETAIL"); + stmt.executeUpdate(); + stmt.close(); + stmt = null; + + stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob"); + stmt.executeUpdate(); + stmt.close(); + stmt = null; + +// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); +// stmt.executeUpdate(); +// stmt.close(); +// stmt = null; + + stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob"); + stmt.executeUpdate(); + stmt.close(); + stmt = null; + + connection.close(); + connection = null; + + isDBConfigured = true; + } catch (SQLException e) { + System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName()); + e.printStackTrace(); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (Exception e) { + // Ignore + } + } + + if (connection != null) { + try { + connection.close(); + } catch (Exception e) { + // Ignore + } + } + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java index df6213284c..2edbc99a77 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java @@ -7,9 +7,9 @@ * 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. @@ -30,12 +30,18 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; +import java.util.Base64; import java.util.Map; +import java.util.Properties; import java.util.UUID; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.utils.UUIDChecker; +import org.openecomp.mso.HealthCheckUtils; import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.utils.CryptoUtils; import javax.ws.rs.GET; import javax.ws.rs.HEAD; import javax.ws.rs.Path; @@ -48,10 +54,14 @@ import org.camunda.bpm.engine.ProcessEngines; @Path("/") public class HealthCheckHandler { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private static final String SITENAME = "mso.sitename"; private static final String ADPTER_ENDPOINT = "mso.adapters.db.endpoint"; private static final String CONFIG = "mso.bpmn.urn.properties"; + private static final String PENGINE_PROPERTY = "processengine.properties"; + private static final String PENGINE_PARAM = "processEngineName"; + private static final String CREDENTIAL = "mso.adapters.db.auth"; + private static final String MSOKEY = "mso.msoKey"; private static final String CHECK_HTML = "Health CheckApplication ready"; private static final String NOT_FOUND = "Application Not StartedApplication not started. Properties file missing or invalid or database Connection failed"; @@ -66,6 +76,59 @@ public class HealthCheckHandler { .entity (NOT_FOUND) .build (); + @HEAD + @GET + @Path("/nodehealthcheck") + @Produces("text/html") + public Response nodeHealthcheck () { + MsoLogger.setServiceName ("NodeHealthcheck"); + // Generate a Request Id + String requestId = UUIDChecker.generateUUID(msoLogger); + + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map props = propertyConfiguration.getProperties(CONFIG); + + if (props == null) { + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.AvailabilityError, "Unable to load " + CONFIG); + + return NOT_STARTED_RESPONSE; + } + + String siteName = props.get(SITENAME); + String endpoint = props.get(ADPTER_ENDPOINT); + + if (null == siteName || siteName.length () == 0 || null == endpoint || endpoint.length () == 0) { + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, "Unable to load key attributes (" + SITENAME + " or " + ADPTER_ENDPOINT + ") from the config file:" + CONFIG); + + return NOT_STARTED_RESPONSE; + } + + try { + if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY))) { + msoLogger.debug("This site is currently disabled for maintenance."); + return HEALTH_CHECK_NOK_RESPONSE; + } + } catch (Exception e) { + + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while getting SiteStatus", e); + + msoLogger.debug("Exception while getting SiteStatus"); + return NOT_STARTED_RESPONSE; + } + + + HealthCheckUtils healthCheck = new HealthCheckUtils (); + if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.BPMN, requestId)) { + msoLogger.debug("nodeHealthcheck - Successful"); + return HealthCheckUtils.HEALTH_CHECK_RESPONSE; + } else { + msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available."); + return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; + } + } + @HEAD @GET @Path("/healthcheck") @@ -95,7 +158,7 @@ public class HealthCheckHandler { } try { - if (!this.getSiteStatus (endpoint, siteName)) { + if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY))) { msoLogger.debug("This site is currently disabled for maintenance."); return HEALTH_CHECK_NOK_RESPONSE; } @@ -108,7 +171,13 @@ public class HealthCheckHandler { } try { - ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery().list(); + InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(PENGINE_PROPERTY); + Properties prop = new Properties(); + prop.load(stream); + String [] engineNames = prop.getProperty(PENGINE_PARAM).split(","); + for (String engine : engineNames) { + ProcessEngines.getProcessEngine(engine).getIdentityService().createGroupQuery().list(); + } } catch (final Exception e) { msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while verifying Camunda engine", e); @@ -144,8 +213,18 @@ public class HealthCheckHandler { } } - private boolean getSiteStatus (String url, String site) throws Exception { - HttpResponse response; + private String decrypt(String encryptedString, String key){ + try { + if (encryptedString != null || !encryptedString.isEmpty() && key != null && !key.isEmpty()) { + return CryptoUtils.decrypt(encryptedString, key); + } + } catch (Exception e) { + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Failed to decrypt credentials", e); + } + return null; + } + + private boolean getSiteStatus (String url, String site, String credential, String key) throws Exception { // set the connection timeout value to 30 seconds (30000 milliseconds) RequestConfig.Builder requestBuilder = RequestConfig.custom(); requestBuilder = requestBuilder.setConnectTimeout(30000); @@ -154,12 +233,17 @@ public class HealthCheckHandler { builder.setDefaultRequestConfig (requestBuilder.build ()); HttpPost post = new HttpPost(url); + + String cred = decrypt(credential, key); + if (cred != null && !cred.isEmpty()) { + post.setHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(cred.getBytes())); + } msoLogger.debug("Post url is: " + url); //now create a soap request message as follows: final StringBuffer payload = new StringBuffer(); payload.append("\n"); - payload.append("\n"); + payload.append("\n"); payload.append("\n"); payload.append("\n"); payload.append("\n"); @@ -173,31 +257,31 @@ public class HealthCheckHandler { HttpEntity entity = new StringEntity(payload.toString(),"UTF-8"); post.setEntity(entity); - try (CloseableHttpClient client = builder.build()) { - response = client.execute(post); - msoLogger.debug("Response received is:" + response); - - int statusCode = response.getStatusLine().getStatusCode(); - if (statusCode != 200) { + CloseableHttpClient client = builder.build (); + HttpResponse response = client.execute(post); + msoLogger.debug("Response received is:" + response); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, - "Communication with DB Adapter failed, The response received from DB Adapter is with failed status code:" + statusCode); + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode != 200) { - Exception e = new Exception("Communication with DB Adapter failed"); - throw e; - } - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, + "Communication with DB Adapter failed, The response received from DB Adapter is with failed status code:" + statusCode); - StringBuffer result = new StringBuffer(); - String line = ""; - while ((line = rd.readLine()) != null) { - result.append(line); - } - msoLogger.debug("Content of the response is:" + result); - String status = result.substring(result.indexOf("") + 8, result.indexOf("")); + Exception e = new Exception("Communication with DB Adapter failed"); + throw e; + } + BufferedReader rd = new BufferedReader( + new InputStreamReader(response.getEntity().getContent())); - return Boolean.valueOf(status); + StringBuffer result = new StringBuffer(); + String line = ""; + while ((line = rd.readLine()) != null) { + result.append(line); } + msoLogger.debug("Content of the response is:" + result); + String status = result.substring(result.indexOf("") + 8, result.indexOf("")); + + client.close (); //shut down the connection + return Boolean.valueOf(status); } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java index 90df1da7e5..d58d046598 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java @@ -7,9 +7,9 @@ * 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. @@ -51,11 +51,11 @@ import org.openecomp.mso.logger.MsoLogger; /** * Loads the property configuration from file system and refreshes the * properties when the property gets changed. - * + * * WARNING: automatic refreshes might not work on network filesystems. */ public class PropertyConfiguration { - + /** * The base name of the MSO BPMN properties file (mso.bpmn.properties). */ @@ -65,7 +65,11 @@ public class PropertyConfiguration { * The base name of the MSO BPMN URN-Mappings properties file (mso.bpmn.urn.properties). */ public static final String MSO_BPMN_URN_PROPERTIES = "mso.bpmn.urn.properties"; - + + /** + * The base name of the MSO Topology properties file (topology.properties). + */ + public static final String MSO_TOPOLOGY_PROPERTIES = "topology.properties"; /** * The name of the meta-property holding the time the properties were loaded * from the file. @@ -75,7 +79,7 @@ public class PropertyConfiguration { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private static final List SUPPORTED_FILES = - Arrays.asList(MSO_BPMN_PROPERTIES, MSO_BPMN_URN_PROPERTIES); + Arrays.asList(MSO_BPMN_PROPERTIES, MSO_BPMN_URN_PROPERTIES, MSO_TOPOLOGY_PROPERTIES); private volatile String msoConfigPath = null; @@ -87,7 +91,7 @@ public class PropertyConfiguration { // The key is the file name private Map timerTaskMap = new HashMap(); - + /** * Singleton holder pattern eliminates locking when accessing the instance * and still provides for lazy initialization. @@ -116,7 +120,7 @@ public class PropertyConfiguration { private PropertyConfiguration() { startUp(); } - + /** * May be called to restart the PropertyConfiguration if it was previously shut down. */ @@ -228,7 +232,7 @@ public class PropertyConfiguration { return Collections.unmodifiableMap(properties); } - + /** * Reads properties from the specified file, updates the property file cache, and * returns the properties in a map. @@ -270,7 +274,7 @@ public class PropertyConfiguration { return properties; } - + /** * File watcher thread which monitors a directory for file modification. */ diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java new file mode 100644 index 0000000000..f58efe79c8 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java @@ -0,0 +1,295 @@ +package org.openecomp.mso.bpmn.core; + +import java.io.FileOutputStream; +import java.io.FileReader; +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.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.openecomp.mso.bpmn.core.PropertyConfiguration; + +/** + * Sets up mso.bpmn.properties and mso.bpmn.urn.properties for unit tests. + */ +public class PropertyConfigurationSetup { + + private static Path msoConfigPath = null; + private static Path bpmnPropertiesPath = null; + private static Path bpmnUrnPropertiesPath = null; + private static boolean modifiedConfiguration = false; + + /** + * Ensures that the the PropertyConfiguration is initialized and that the + * property data is reset to initial values. Any extra properties that are + * specified will be merged with the initial values. The following example + * shows how a test can specify a replacement URN mapping property. + *
+	 *     Map urnProperties =
+	 *         PropertyConfigurationSetup.createBpmnUrnProperties();
+	 *     urnProperties.add("mso.po.timeout", "PT1M");
+	 *     PropertyConfiguration.init(urnProperties);
+	 * 
+ * @param args one or more maps created with createBpmnProperties() + * and/or createBpmnUrnProperties() + */ + public static synchronized void init(Object ... args) throws IOException { + + Map extraBpmnProperties = null; + Map extraBpmnUrnProperties = null; + + boolean propertiesSpecified = false; + + for (Object arg : args) { + @SuppressWarnings("unchecked") + Map properties = (Map) arg; + + String type = properties.get("PROPERTIES-TYPE"); + + if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { + if (properties.size() > 1) { + extraBpmnProperties = properties; + propertiesSpecified = false; + } + } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { + if (properties.size() > 1) { + extraBpmnUrnProperties = properties; + propertiesSpecified = false; + } + } else { + throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); + } + } + + // There are three cases in which we need to change the existing configuration: + // 1) There is no existing configuration, i.e. first time setup + // 2) The existing configuration was modified, i.e. it has non-default values + // 3) Non-default values are specified for this initialization + + if (msoConfigPath == null || modifiedConfiguration || propertiesSpecified) { + modifiedConfiguration = propertiesSpecified; + + Path bpmnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.properties"); + Path bpmnUrnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.urn.properties"); + + if (msoConfigPath == null) { + // Initialize from scratch. + msoConfigPath = Files.createTempDirectory("mso-config-path-"); + System.setProperty("mso.config.path", msoConfigPath.toString()); + msoConfigPath.toFile().deleteOnExit(); + + bpmnPropertiesPath = msoConfigPath.resolve("mso.bpmn.properties"); + mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); + bpmnPropertiesPath.toFile().deleteOnExit(); + + bpmnUrnPropertiesPath = msoConfigPath.resolve("mso.bpmn.urn.properties"); + mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); + bpmnUrnPropertiesPath.toFile().deleteOnExit(); + + PropertyConfiguration.getInstance(); + } else { + // Just reset the data. + PropertyConfiguration.getInstance().clearCache(); + mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); + mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); + } + } + } + + /** + * Resets the PropertyConfiguration to its initial state, as if it had never + * been started. Note that this is a very expensive option and should not + * be needed by most unit tests. + * @throws IOException + */ + public static synchronized void nuke() throws IOException { + if (msoConfigPath == null) { + return; + } + + PropertyConfiguration.getInstance().shutDown(); + + bpmnUrnPropertiesPath.toFile().delete(); + bpmnUrnPropertiesPath = null; + + bpmnPropertiesPath.toFile().delete(); + bpmnPropertiesPath = null; + + msoConfigPath.toFile().delete(); + msoConfigPath = null; + + System.setProperty("mso.config.path", null); + + modifiedConfiguration = false; + } + + /** + * Create a map to hold properties to be added to mso.bpmn.properties. + */ + public static Map createBpmnProperties() { + Map properties = new HashMap(); + properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_PROPERTIES); + return properties; + } + + /** + * Create a map to hold properties to be added to mso.bpmn.urn.properties. + */ + public static Map createBpmnUrnProperties() { + Map properties = new HashMap(); + properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_URN_PROPERTIES); + return properties; + } + + /** + * Adds (or replaces) the specified values in the mso.bpmn.urn.properties file. + * Note that properties added this way may take some time to be loaded by the + * PropertyConfiguration, just like they do when a property file is updated on + * a real MSO system. This method will optionally wait for the new properties + * to be loaded. Timeout results in an IOException. + * @param values new properties + * @param wait maximum amount of time to wait for new properties to be loaded, + * in milliseconds. A value of zero means, "Do not wait." + * @throws IOException + */ + public static synchronized void addProperties(Map properties, long wait) + throws IOException, InterruptedException { + + if (msoConfigPath == null) { + throw new IllegalStateException(); + } + + String type = properties.get("PROPERTIES-TYPE"); + Path path; + + if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { + path = bpmnPropertiesPath; + } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { + path = bpmnUrnPropertiesPath; + } else { + throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); + } + + String oldTimestamp = PropertyConfiguration.getInstance().getProperties(type) + .get(PropertyConfiguration.TIMESTAMP_PROPERTY); + + modifiedConfiguration = true; + addProperties(properties, path); + + if (wait <= 0) { + return; + } + + long endTime = System.currentTimeMillis() + wait; + + while (true) { + Thread.sleep(250); + + String newTimestamp = PropertyConfiguration.getInstance().getProperties(type) + .get(PropertyConfiguration.TIMESTAMP_PROPERTY); + + if (newTimestamp != oldTimestamp) { + return; + } + + long now = System.currentTimeMillis(); + + if (now >= endTime) { + throw new IOException("Timed out after " + wait + + "ms waiting for PropertyConfiguration change"); + } + } + } + + /** + * Helper method that adds properties to the specified file. + */ + private static void addProperties(Map values, Path path) + throws IOException { + + FileReader fileReader = null; + FileOutputStream outputStream = null; + + try { + fileReader = new FileReader(path.toFile()); + Properties properties = new Properties(); + properties.load(fileReader); + + for (String key : values.keySet()) { + if (!key.equals("PROPERTIES-TYPE")) { + properties.setProperty(key, values.get(key)); + } + } + + outputStream = new FileOutputStream(path.toFile()); + properties.store(outputStream, "Custom Test Properties"); + } finally { + if (fileReader != null) { + try { + fileReader.close(); + } catch (IOException e) { + // Ignore + } + } + + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + // Ignore + } + } + } + } + + /** + * Helper method that copies properties from the specified source file, and + * optionally merges them with the specified extra values, then writes the + * whole mess to the destination file. + */ + private static void mergeCopy(Path sourcePath, Map extraValues, Path destPath) + throws IOException { + if (extraValues == null || extraValues.isEmpty()) { + Files.copy(sourcePath, destPath, StandardCopyOption.REPLACE_EXISTING); + return; + } + + FileReader fileReader = null; + FileOutputStream outputStream = null; + + try { + fileReader = new FileReader(sourcePath.toFile()); + Properties properties = new Properties(); + properties.load(fileReader); + + for (String key : extraValues.keySet()) { + if (!key.equals("PROPERTIES-TYPE")) { + properties.setProperty(key, extraValues.get(key)); + } + } + + outputStream = new FileOutputStream(destPath.toFile()); + properties.store(outputStream, "Custom Test Properties"); + } finally { + if (fileReader != null) { + try { + fileReader.close(); + } catch (IOException e) { + // Ignore + } + } + + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + // Ignore + } + } + } + } +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java index 8a7b20016b..926f2af9aa 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java @@ -240,4 +240,4 @@ public class XQueryScriptTask extends BaseTask { } } } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index 8329746347..462bda8077 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -21,8 +21,11 @@ package org.openecomp.mso.bpmn.core.json; import java.util.Iterator; +import java.util.Map; +import java.util.HashMap; import java.util.StringTokenizer; +import org.camunda.bpm.engine.runtime.Execution; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -79,7 +82,7 @@ public class JsonUtils { /** * Uses the JSONObject static method to convert a JSON doc to XML. - * Note: this method will not generate valid XML if the JSONObject + * Note: this method may not generate valid XML if the JSONObject * contains JSONArrays which are used to represent XML attributes * in the JSON doc. * @@ -92,9 +95,11 @@ public class JsonUtils { try { JSONObject jsonObj = new JSONObject(jsonStr); if (pretty) { - return XmlTool.normalize(XML.toString(jsonObj)); + // use the local class method which properly handles certain JSONArray content + return XmlTool.normalize(toXMLString(jsonObj, null)); } else { - return XML.toString(jsonObj); +// use the local class method which properly handles certain JSONArray content + return toXMLString(jsonObj, null); } } catch (Exception e){ msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString()); @@ -102,6 +107,154 @@ public class JsonUtils { } } + /** + * Uses a modified version of the org.json.XML toString() algorithm + * to convert a JSONObject to an XML Doc. The intent of this is to + * correctly generate XML from JSON including TAGs for JSONArrays + * + * @param jsonObj org.json.JSON object to be converted to XML + * @param tagName optional XML tagname supplied primarily during recursive calls + * @return String containing the XML translation + */ + public static String toXMLString(Object obj, String tagName) throws JSONException { + StringBuffer strBuf = new StringBuffer(); + int i; + JSONArray jsonArr; + JSONObject jsonObj; + String key; + Iterator keys; + int len; + String str; + Object curObj; + if (obj instanceof JSONObject) { + // msoLogger.debug("toXMLString(): is a JSONObject"); + // append "" to the XML output + if (tagName != null) { +// msoLogger.debug("toXMLString(): adding opening tagName: " + tagName); + strBuf.append("<"); + strBuf.append(tagName); + strBuf.append(">"); + } + // iterate thru the keys. + jsonObj = (JSONObject) obj; + keys = jsonObj.keys(); + while (keys.hasNext()) { + key = keys.next().toString(); + // msoLogger.debug("toXMLString(): key is " + k); + curObj = jsonObj.opt(key); + if (curObj == null) { + curObj = ""; + } + if (curObj instanceof String) { + str = (String) curObj; + } else { + str = null; + } + // append the content to the XML output + if (key.equals("content")) { + if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); + for (i = 0; i < len; i += 1) { + if (i > 0) { + strBuf.append('\n'); + } + strBuf.append(XML.escape(jsonArr.get(i).toString())); + } + } else { + strBuf.append(XML.escape(curObj.toString())); + } + // append an array of similar keys to the XML output + } else if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); +// msoLogger.debug("toXMLString(): found JSONArray: " + key + ", size: " + len); + for (i = 0; i < len; i += 1) { + curObj = jsonArr.get(i); + if (curObj instanceof JSONArray) { +// The XML tags for the nested array should be generated below when this method +// is called recursively and the JSONArray object is passed +// strBuf.append("<"); +// strBuf.append(key); +// strBuf.append(">"); + strBuf.append(toXMLString(curObj, null)); +// strBuf.append(""); + } else { +// msoLogger.debug("toXMLString(): recursive call toXML() with tagName null"); + // append the opening tag for the array (before 1st element) + if (i == 0) { + strBuf.append("<"); + strBuf.append(key); + strBuf.append(">"); + } + // append the opening tag for the array + strBuf.append(toXMLString(curObj, null)); + // append the closing tag for the array (after last element) + if (i == (len - 1)) { + strBuf.append(""); + } + } + } + } else if (curObj.equals("")) { + // append a closing tag "" to the XML output + strBuf.append("<"); + strBuf.append(key); + strBuf.append("/>"); + } else { +// msoLogger.debug("toXMLString(): recursive call toXMLString() with tagName: " + key); + strBuf.append(toXMLString(curObj, key)); + } + // msoLogger.debug("toXML(): partial XML: " + strBuf.toString()); + } + if (tagName != null) { + // append the closing tag "" to the XML output +// msoLogger.debug("toXMLString(): adding closing tagName: " + tagName); + strBuf.append(""); + } + return strBuf.toString(); + // XML does not have good support for arrays. If an array appears in a place + // where XML is lacking, synthesize an < array > element. + } else if (obj instanceof JSONArray) { + jsonArr = (JSONArray) obj; + len = jsonArr.length(); + for (i = 0; i < len; ++i) { + curObj = jsonArr.opt(i); + strBuf.append(toXMLString(curObj, (tagName == null) ? "array" + : tagName)); + } + return strBuf.toString(); + } else { +// msoLogger.debug("toXML(): in else block with tagName: " + tagName); + str = (obj == null) ? "null" : XML.escape(obj.toString()); + return (tagName == null) ? "\"" + str + "\"" + : (str.length() == 0) ? "<" + tagName + "/>" : "<" + + tagName + ">" + str + ""; + } + } + + /** + * Formats the JSON String using the value of MSOJsonIndentFactor. + * + * @param jsonStr String containing the JSON doc + * @return String containing the formatted JSON doc + */ + public static String prettyJson(String jsonStr) { +// String isDebugLogEnabled = "true"; + try { + JSONObject jsonObj = new JSONObject(jsonStr); + return jsonObj.toString(MSOJsonIndentFactor); + } catch (Exception e){ + msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString()); + return null; + } + } + /** * Invokes json2xml(String, Boolean) defaulting to 'pretty' output. * @@ -111,23 +264,43 @@ public class JsonUtils { public static String json2xml(String jsonStr) { return json2xml(jsonStr, true); } - + /** - * Uses the JSONObject static method to convert a JSON doc to XML. + * Returns an Iterator over the JSON keys in the specified JSON doc. * * @param jsonStr String containing the JSON doc * @return Iterator over the JSON keys + * @throws JSONException if the doc cannot be parsed */ - public static Iterator getJsonIterator(String jsonStr) { -// String isDebugLogEnabled = "true"; - try { - JSONObject json = new JSONObject(jsonStr); - return json.keys(); - - } catch (Exception e){ - msoLogger.debug("getJsonIterator(): unable to parse json to retrieve the keys iterator. Exception was: " + e.toString()); - return null; + public static Iterator getJsonIterator(String jsonStr) throws JSONException { + return new JSONObject(jsonStr).keys(); + } + + /** + * Returns the name of the "root" property in the specified JSON doc. The + * "root" property is the single top-level property in the JSON doc. An + * exception is thrown if the doc is empty or if it contains more than one + * top-level property. + * + * @param jsonStr String containing the JSON doc + * @return the name of the "root" property + * @throws JSONException if the doc cannot be parsed, or if it is empty, or if + * it contains more than one top-level property + */ + public static String getJsonRootProperty(String jsonStr) throws JSONException { + Iterator iter = getJsonIterator(jsonStr); + + if (!iter.hasNext()) { + throw new JSONException("Empty JSON object"); } + + String rootPropertyName = iter.next(); + + if (iter.hasNext()) { + throw new JSONException("JSON object has more than one root property"); + } + + return rootPropertyName; } /** @@ -161,11 +334,73 @@ public class JsonUtils { } return null; } + + + /** + * Invokes the getJsonRawValue() method with the wrap flag set to true + * and returns the String equivalent of the json node object returned. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static String getJsonNodeValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys, true); + if (rawValue == null) { + return null; + } else { + if (rawValue instanceof String) { + msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + ((String) rawValue).toString()); + return (String) rawValue; + } else { + msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString()); + return rawValue.toString(); + } + } + } catch (Exception e) { + msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString()); + } + return null; + } /** - * Invokes the getJsonRawValue() method to obtain the JSONArray associated with - * the specified keys. The JSONArray is then walked to retrieve the content value of - * the specified field name. + * Invokes the getJsonRawValue() method and returns the String equivalent of + * the object returned. + * + * TBD: May need separate methods for boolean, float, and integer fields if the + * String representation is not sufficient to meet client needs. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static int getJsonIntValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return 0; + } else { + if (rawValue instanceof Integer) { + msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + ((String) rawValue).toString()); + return (Integer) rawValue; + } else { + msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString()); + return 0; + } + } + } catch (Exception e) { + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + } + return 0; + } + + /** + * Invokes the getJsonParamValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the first array + * value associated with the specified field name (index=0). * * @param jsonStr String containing the JSON doc * @param keys full key path to the target value in the format of "key1.key2.key3..." @@ -173,6 +408,21 @@ public class JsonUtils { * @return String param value associated with field name */ public static String getJsonParamValue(String jsonStr, String keys, String name) { + return getJsonParamValue(jsonStr, keys, name, 0); + } + + /** + * Invokes the getJsonRawValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the nth array + * value associated with the specified field name and index + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @param name field name for the param to be retrieved + * @param index the nth param associated with name starting at 0 + * @return String param value associated with field name + */ + public static String getJsonParamValue(String jsonStr, String keys, String name, int index) { // String isDebugLogEnabled = "true"; try { Object rawValue = getJsonRawValue(jsonStr, keys); @@ -181,14 +431,28 @@ public class JsonUtils { } else { if (rawValue instanceof JSONArray) { msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + ((JSONArray) rawValue).toString()); - for (int i = 0; i < ((JSONArray) rawValue).length(); i++) { + int arrayLen = ((JSONArray) rawValue).length(); + if (index < 0 || arrayLen < index+1) { + msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen); + return null; + } + int foundCnt = 0; + for (int i = 0; i < arrayLen; i++) { msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString()); if (((JSONArray) rawValue).get(i) instanceof JSONObject) { msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject"); JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i); - if (jsonObj.get("name").equals(name)) { - msoLogger.debug("getJsonParamValue(): found value: " + (String) jsonObj.get("content") + " for name: " + name); - return (String) jsonObj.get("content"); + String parmValue = jsonObj.get(name).toString(); + if (parmValue != null) { + msoLogger.debug("getJsonParamValue(): found value: " + parmValue + " for name: " + name + " and index: " + i); + if (foundCnt == index) { + return parmValue; + } else { + foundCnt++; + continue; + } + } else { + continue; } } else { msoLogger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject=" + rawValue.toString()); @@ -275,6 +539,49 @@ public class JsonUtils { return keyValue; } + /** + * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the + * single key/field name specified. Returns the associated value if found or null if the key is not found + * + * @param jsonObj JSONObject representation of the the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) { +// String isDebugLogEnabled = "true"; + Integer keyValue = 0; + try { + if (jsonObj.has(key)) { + msoLogger.debug("getJsonValueForKey(): found value for key=" + key); + return ((Integer) jsonObj.get(key)); + } else { + msoLogger.debug("getJsonValueForKey(): iterating over the keys"); + Iterator itr = jsonObj.keys(); + while (itr.hasNext()) { + String nextKey = (String) itr.next(); + Object obj = jsonObj.get(nextKey); + if (obj instanceof JSONObject) { + msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); + keyValue = getJsonIntValueForKey((JSONObject) obj, key); + if (keyValue != null) { + msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key); + break; + } + } else { + msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); + } + } + } + } catch (JSONException je) { + // JSONObject::get() throws this exception if one of the specified keys is not found + msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key); + keyValue = null; + } catch (Exception e) { + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + } + return keyValue; + } + /** * Boolean method to determine if a key path is valid for the JSON doc. Invokes * getJsonValue(). @@ -365,6 +672,22 @@ public class JsonUtils { * @return Object field value associated with keys */ private static Object getJsonRawValue(String jsonStr, String keys) { + return getJsonRawValue(jsonStr, keys, false); + } + + /** + * Walks the JSON doc using the full key path to retrieve the associated + * value. All but the last key points to the 'parent' object name(s) in order + * in the JSON hierarchy with the last key pointing to the target value. + * The value returned is a Java object. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * * @param wrap Boolean which determines if returned JSONObjects sould be "wrapped" + * Note: wrap does not apply to returned scalar values + * @return Object field value associated with keys + */ + private static Object getJsonRawValue(String jsonStr, String keys, Boolean wrap) { // String isDebugLogEnabled = "true"; String keyStr = ""; try { @@ -383,11 +706,19 @@ public class JsonUtils { return keyValue; } } - // we should not hit this point: either the key points to a valid value and - // we return it above or the key is invalid and we handle the JSONException - // below and return null - return null; - + // return the json 'node' that the key points to + // note: since this is a json object and not a scalar value, + // use the wrap flag to determine if the object should + // be wrapped with a root node value + // (the last key in the keys String) + if (wrap) { + JSONObject wrappedJsonObj = new JSONObject(); + wrappedJsonObj.put(keyStr, jsonObj); + return wrappedJsonObj.toString(); + } else { + return jsonObj.toString(); + } + } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr); @@ -439,5 +770,61 @@ public class JsonUtils { } return null; } + + /** + * This json util method converts a json "Key" and "Value" + * entry Array to a Java map. + * + * @param execution + * @param entryArray - the json value of the entry Array + * + * @return map - a Map containing the entries + * + */ + public Map entryArrayToMap(Execution execution, String entryArray) { + msoLogger.debug("Started Entry Array To Map Util Method"); + + Map map = new HashMap(); + + //Populate Map + String entryListJson = "{ \"entry\":" + entryArray + "}"; + JSONObject obj = new JSONObject(entryListJson); + JSONArray arr = obj.getJSONArray("entry"); + for (int i = 0; i < arr.length(); i++){ + JSONObject jo = arr.getJSONObject(i); + String key = jo.getString("key"); + String value =jo.getString("value"); + map.put(key, value); + } + msoLogger.debug("Outgoing Map is: " + map); + msoLogger.debug("Completed Entry Array To Map Util Method"); + return map; + } + + + /** + * Invokes the getJsonRawValue() method to determine if the + * json element/variable exist. Returns true if the + * json element exist + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return boolean field value associated with keys + */ + public static boolean jsonElementExist(String jsonStr, String keys) { + + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return false; + } else { + return true; + } + } catch (Exception e) { + msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString()); + } + return true; + } + } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 8e3f254def..2453700bce 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -399,8 +399,8 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { MsoLogger.setServiceName("MSO." + prefix.substring(0,prefix.length()-1)); } - String requestId = (String) execution.getVariable("att-mso-request-id"); - String svcid = (String) execution.getVariable("att-mso-service-instance-id"); + String requestId = (String) execution.getVariable("mso-request-id"); + String svcid = (String) execution.getVariable("mso-service-instance-id"); MsoLogger.setLogContext(requestId, svcid); long startTime = startTimes.remove(id); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java deleted file mode 100644 index 13eed2d530..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * ============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.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Sets up the unit test (H2) database for Camunda. - */ -public class CamundaDBSetup { - private static boolean isDBConfigured = false; - - public static synchronized void configure() throws SQLException { - if (isDBConfigured) { - return; - } - - System.out.println("Configuring the Camunda H2 database for MSO"); - - Connection connection = null; - PreparedStatement stmt = null; - - try { - connection = DriverManager.getConnection( - "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", ""); - - stmt = connection.prepareStatement("delete from ACT_HI_VARINST"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("delete from ACT_HI_DETAIL"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; - - connection.close(); - connection = null; - - isDBConfigured = true; - } catch (SQLException e) { - System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName()); - e.printStackTrace(); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (Exception e) { - // Ignore - } - } - - if (connection != null) { - try { - connection.close(); - } catch (Exception e) { - // Ignore - } - } - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java deleted file mode 100644 index 6f1cd7d8cc..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java +++ /dev/null @@ -1,315 +0,0 @@ -/*- - * ============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.test; - -import java.io.FileOutputStream; -import java.io.FileReader; -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.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; - -/** - * Sets up mso.bpmn.properties and mso.bpmn.urn.properties for unit tests. - */ -public class PropertyConfigurationSetup { - - private static Path msoConfigPath = null; - private static Path bpmnPropertiesPath = null; - private static Path bpmnUrnPropertiesPath = null; - private static boolean modifiedConfiguration = false; - - /** - * Ensures that the the PropertyConfiguration is initialized and that the - * property data is reset to initial values. Any extra properties that are - * specified will be merged with the initial values. The following example - * shows how a test can specify a replacement URN mapping property. - *
-	 *     Map urnProperties =
-	 *         PropertyConfigurationSetup.createBpmnUrnProperties();
-	 *     urnProperties.add("mso.po.timeout", "PT1M");
-	 *     PropertyConfiguration.init(urnProperties);
-	 * 
- * @param args one or more maps created with createBpmnProperties() - * and/or createBpmnUrnProperties() - */ - public static synchronized void init(Object ... args) throws IOException { - - Map extraBpmnProperties = null; - Map extraBpmnUrnProperties = null; - - boolean propertiesSpecified = false; - - for (Object arg : args) { - @SuppressWarnings("unchecked") - Map properties = (Map) arg; - - String type = properties.get("PROPERTIES-TYPE"); - - if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { - if (properties.size() > 1) { - extraBpmnProperties = properties; - propertiesSpecified = false; - } - } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { - if (properties.size() > 1) { - extraBpmnUrnProperties = properties; - propertiesSpecified = false; - } - } else { - throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); - } - } - - // There are three cases in which we need to change the existing configuration: - // 1) There is no existing configuration, i.e. first time setup - // 2) The existing configuration was modified, i.e. it has non-default values - // 3) Non-default values are specified for this initialization - - if (msoConfigPath == null || modifiedConfiguration || propertiesSpecified) { - modifiedConfiguration = propertiesSpecified; - - Path bpmnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.properties"); - Path bpmnUrnPropertiesSourcePath = Paths.get("src", "test", "resources", "mso.bpmn.urn.properties"); - - if (msoConfigPath == null) { - // Initialize from scratch. - msoConfigPath = Files.createTempDirectory("mso-config-path-"); - System.setProperty("mso.config.path", msoConfigPath.toString()); - msoConfigPath.toFile().deleteOnExit(); - - bpmnPropertiesPath = msoConfigPath.resolve("mso.bpmn.properties"); - mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); - bpmnPropertiesPath.toFile().deleteOnExit(); - - bpmnUrnPropertiesPath = msoConfigPath.resolve("mso.bpmn.urn.properties"); - mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); - bpmnUrnPropertiesPath.toFile().deleteOnExit(); - - PropertyConfiguration.getInstance(); - } else { - // Just reset the data. - PropertyConfiguration.getInstance().clearCache(); - mergeCopy(bpmnPropertiesSourcePath, extraBpmnProperties, bpmnPropertiesPath); - mergeCopy(bpmnUrnPropertiesSourcePath, extraBpmnUrnProperties, bpmnUrnPropertiesPath); - } - } - } - - /** - * Resets the PropertyConfiguration to its initial state, as if it had never - * been started. Note that this is a very expensive option and should not - * be needed by most unit tests. - * @throws IOException - */ - public static synchronized void nuke() throws IOException { - if (msoConfigPath == null) { - return; - } - - PropertyConfiguration.getInstance().shutDown(); - - bpmnUrnPropertiesPath.toFile().delete(); - bpmnUrnPropertiesPath = null; - - bpmnPropertiesPath.toFile().delete(); - bpmnPropertiesPath = null; - - msoConfigPath.toFile().delete(); - msoConfigPath = null; - - System.setProperty("mso.config.path", null); - - modifiedConfiguration = false; - } - - /** - * Create a map to hold properties to be added to mso.bpmn.properties. - */ - public static Map createBpmnProperties() { - Map properties = new HashMap(); - properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_PROPERTIES); - return properties; - } - - /** - * Create a map to hold properties to be added to mso.bpmn.urn.properties. - */ - public static Map createBpmnUrnProperties() { - Map properties = new HashMap(); - properties.put("PROPERTIES-TYPE", PropertyConfiguration.MSO_BPMN_URN_PROPERTIES); - return properties; - } - - /** - * Adds (or replaces) the specified values in the mso.bpmn.urn.properties file. - * Note that properties added this way may take some time to be loaded by the - * PropertyConfiguration, just like they do when a property file is updated on - * a real MSO system. This method will optionally wait for the new properties - * to be loaded. Timeout results in an IOException. - * @param values new properties - * @param wait maximum amount of time to wait for new properties to be loaded, - * in milliseconds. A value of zero means, "Do not wait." - * @throws IOException - */ - public static synchronized void addProperties(Map properties, long wait) - throws IOException, InterruptedException { - - if (msoConfigPath == null) { - throw new IllegalStateException(); - } - - String type = properties.get("PROPERTIES-TYPE"); - Path path; - - if (PropertyConfiguration.MSO_BPMN_PROPERTIES.equals(type)) { - path = bpmnPropertiesPath; - } else if (PropertyConfiguration.MSO_BPMN_URN_PROPERTIES.equals(type)) { - path = bpmnUrnPropertiesPath; - } else { - throw new IllegalArgumentException("Not a supported PROPERTIES-TYPE map"); - } - - String oldTimestamp = PropertyConfiguration.getInstance().getProperties(type) - .get(PropertyConfiguration.TIMESTAMP_PROPERTY); - - modifiedConfiguration = true; - addProperties(properties, path); - - if (wait <= 0) { - return; - } - - long endTime = System.currentTimeMillis() + wait; - - while (true) { - Thread.sleep(250); - - String newTimestamp = PropertyConfiguration.getInstance().getProperties(type) - .get(PropertyConfiguration.TIMESTAMP_PROPERTY); - - if (newTimestamp != oldTimestamp) { - return; - } - - long now = System.currentTimeMillis(); - - if (now >= endTime) { - throw new IOException("Timed out after " + wait - + "ms waiting for PropertyConfiguration change"); - } - } - } - - /** - * Helper method that adds properties to the specified file. - */ - private static void addProperties(Map values, Path path) - throws IOException { - - FileReader fileReader = null; - FileOutputStream outputStream = null; - - try { - fileReader = new FileReader(path.toFile()); - Properties properties = new Properties(); - properties.load(fileReader); - - for (String key : values.keySet()) { - if (!key.equals("PROPERTIES-TYPE")) { - properties.setProperty(key, values.get(key)); - } - } - - outputStream = new FileOutputStream(path.toFile()); - properties.store(outputStream, "Custom Test Properties"); - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (IOException e) { - // Ignore - } - } - - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - // Ignore - } - } - } - } - - /** - * Helper method that copies properties from the specified source file, and - * optionally merges them with the specified extra values, then writes the - * whole mess to the destination file. - */ - private static void mergeCopy(Path sourcePath, Map extraValues, Path destPath) - throws IOException { - if (extraValues == null || extraValues.isEmpty()) { - Files.copy(sourcePath, destPath, StandardCopyOption.REPLACE_EXISTING); - return; - } - - FileReader fileReader = null; - FileOutputStream outputStream = null; - - try { - fileReader = new FileReader(sourcePath.toFile()); - Properties properties = new Properties(); - properties.load(fileReader); - - for (String key : extraValues.keySet()) { - if (!key.equals("PROPERTIES-TYPE")) { - properties.setProperty(key, extraValues.get(key)); - } - } - - outputStream = new FileOutputStream(destPath.toFile()); - properties.store(outputStream, "Custom Test Properties"); - } finally { - if (fileReader != null) { - try { - fileReader.close(); - } catch (IOException e) { - // Ignore - } - } - - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - // Ignore - } - } - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml b/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml index fd5d586278..274c859dd9 100644 --- a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml +++ b/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml @@ -32,12 +32,12 @@ 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 deleted file mode 100644 index 71b9e089c3..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 deleted file mode 100644 index 2449157b43..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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 deleted file mode 100644 index 113c819f8c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 deleted file mode 100644 index 69ee3dcd48..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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 index 6176029075..8a2b0a5578 100644 --- 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 @@ -18,6 +18,26 @@ * ============LICENSE_END========================================================= */ +/*- + * ============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; @@ -25,11 +45,11 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.CharBuffer; 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; @@ -42,214 +62,311 @@ import org.openecomp.mso.bpmn.core.xml.XmlTool; */ 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(); - } - } + 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; + + private String xmlArrayReq = + "" + EOL + + " BROADBAND" + EOL + + " IVLAN" + EOL + + " SHELLUCPE31" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 1000BASE-T" + EOL + + " ATT" + EOL + + " BT/SLIR/70911" + EOL + + " Active" + EOL + + " WAN1" + EOL + + " ATT" + EOL + + " 100" + EOL + + " ELECTRICAL" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 10/100/1000BASE-T" + EOL + + " ATT" + EOL + + " AS/KRFN/34611" + EOL + + " Active" + EOL + + " WAN2" + EOL + + " ATT" + EOL + + " 10000" + EOL + + " MMF" + EOL + + " " + EOL + + " " + EOL + + " ASD-987-M31" + EOL + + " USOSTCDALTX0101UJZZ31" + EOL + + " FG-VM00*" + EOL + + ""; + + // JSON request w/ embedded XML will be read from a file + private String jsonReq = null; + private String jsonReqArray = null; + + @Before + public void initialize() { + File file = new File("src/test/resources/request.json"); + File file2 = new File("src/test/resources/requestArray.json"); + FileInputStream fis = null; + + try { + fis = new FileInputStream(file); + BufferedReader br = new BufferedReader(new InputStreamReader(fis)); +// jsonReq = br.readLine(); + CharBuffer cbuf = CharBuffer.allocate((int)file.length()+1); + br.read(cbuf); + cbuf.flip(); + jsonReq = cbuf.toString(); + 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"); + } + fis.close(); + fis = new FileInputStream(file2); + br = new BufferedReader(new InputStreamReader(fis)); +// jsonReqArray = br.readLine(); + cbuf = CharBuffer.allocate((int)file.length()+1); + br.read(cbuf); + cbuf.flip(); + jsonReqArray = cbuf.toString(); + if (jsonReq != null) { + System.out.println("initialize(): json request w/ array: " + jsonReqArray); + } else { + System.out.println("initialize(): failed to read json request from src/test/resources/request2.json"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fis != null) + fis.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @After + public void cleanup(){ + } + + @Test +// @Ignore + 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 non-data 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 non-data 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 +// @Ignore + 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/array value (originally a XML attribute) + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name"); +// Assert.assertEquals(value, "[{\"content\":\"network1111\",\"name\":\"network\"},{\"content\":\"server1111\",\"name\":\"server\"}]"); + Assert.assertEquals(value, "network"); + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content"); + Assert.assertEquals(value, "network1111"); + // retrieving a parameter/array value by index + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content", 1); + Assert.assertEquals(value, "server1111"); + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 1); + Assert.assertEquals(value, "server"); + // failure due to invalid parameter name + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam"); + Assert.assertEquals(value, null); + // failure due to array index out of bounds + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2); + 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 +// @Ignore + 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 +// @Ignore + 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); + 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(); + } + } + + @Test +// @Ignore + // Tests the conversion of a JSON Doc containing a JSON Array to XML + public void testConversionArray() { + try { + String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); + System.out.println("testConversionArray(): json value: " + JsonUtils.prettyJson(jsonParm)); + String xmlOut = JsonUtils.json2xml(jsonParm); + System.out.println("testConversionArray(): json parameters to xml: " + xmlOut); + // strip all the non-data whitespace + xmlOut = xmlOut.replaceAll(">\\s*<", "><"); + System.out.println("testConversionArray(): XML after removing whitespace:" + xmlOut); + String xmlTest = xmlArrayReq.replaceAll(">\\s*<", "><"); +// System.out.println("testConversion(): xml test: " + xmlTest); +// System.out.println("testConversion(): xml out: " + xmlOut); + + Diff diffXml; + try { + diffXml = new Diff(xmlTest, xmlOut); + Assert.assertTrue(diffXml.similar()); +// Assert.assertTrue(diffXml.identical()); + } 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 deleted file mode 100644 index 70e505095e..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 deleted file mode 100644 index ab7ee56884..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java +++ /dev/null @@ -1,342 +0,0 @@ -/** - * 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 deleted file mode 100644 index f62d6afaf0..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 deleted file mode 100644 index 03cb94f4e6..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 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 index ff92355b8a..fa0f8d8dd8 100644 --- 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 @@ -18,6 +18,26 @@ * ============LICENSE_END========================================================= */ +/*- + * ============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; @@ -31,7 +51,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.openecomp.mso.bpmn.test.PropertyConfigurationSetup; public class PropertyConfigurationTest { @Before 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 deleted file mode 100644 index 6422685f92..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 deleted file mode 100644 index c134c9cca9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java +++ /dev/null @@ -1,331 +0,0 @@ -/** - * 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 deleted file mode 100644 index 741872af7a..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 deleted file mode 100644 index 4b11c761cc..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * 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 deleted file mode 100644 index e26f5a9a46..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7dc6ca1e4e..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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 index 3f2f74d2f7..a45f1fdba2 100644 --- 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 @@ -20,6 +20,8 @@ package org.openecomp.mso.bpmn.core; +import static org.junit.Assert.assertNotNull; + import java.util.HashMap; import java.util.Map; @@ -33,8 +35,6 @@ 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; /** @@ -61,6 +61,7 @@ public class TestBaseTask { variables.put("lastVisit", (Long)1438270117000L); RuntimeService runtimeService = processEngineRule.getRuntimeService(); + assertNotNull(runtimeService); processEngineRule.getTaskService(); runtimeService.startProcessInstanceByKey("BaseTaskTest", variables); } 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 deleted file mode 100644 index 64220f016d..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 deleted file mode 100644 index 93151d3271..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * 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 deleted file mode 100644 index 1891c8d478..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 deleted file mode 100644 index 88e0e0f96f..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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 deleted file mode 100644 index a14934193e..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 deleted file mode 100644 index b0c1585e59..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java +++ /dev/null @@ -1,533 +0,0 @@ -/** - * 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 deleted file mode 100644 index fec405ef96..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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 deleted file mode 100644 index 6d05db0b80..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * 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 deleted file mode 100644 index 9c17caeaf4..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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 deleted file mode 100644 index 183ea84b58..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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() { - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn index d94a0c5b21..bb15ce2e5e 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn +++ b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 diff --git a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml index 4858ea0c0e..3fa222988c 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml +++ b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml @@ -1,28 +1,8 @@ - - - + - + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> diff --git a/bpmn/MSOCoreBPMN/src/test/resources/request.json b/bpmn/MSOCoreBPMN/src/test/resources/request.json index bdca336a0b..8fa195b839 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/request.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/request.json @@ -1,26 +1,26 @@ { "variables": { "bpmnRequest": { - "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:8080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", + "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:28080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n 01|VLXM|121601/PT\n PointToPoint\n MTSNJA4LX01\n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", "type": "String" }, "host": { "value": "localhost", "type": "String" }, - "att-mso-schema-version": { + "mso-schema-version": { "value": "v1", "type": "String" }, - "att-mso-request-id": { + "mso-request-id": { "value": "d00eb185-b1d7-429e-aca3-42a61b459535", "type": "String" }, - "att-mso-service-instance-id": { + "mso-service-instance-id": { "value": "AA01|VLXM|003717||SW_INTERNET", "type": "String" }, - "att-mso-service-request-timeout": { + "mso-service-request-timeout": { "value": "180", "type": "String" } diff --git a/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json new file mode 100644 index 0000000000..238128865b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json @@ -0,0 +1,54 @@ +{ + "requestDetails": { + "requestInfo": { + "callbackUrl": "http://localhost:28080/simulada/CCD/AsyncRequestStatus", + "source": "CCD", + "instanceName": "USOSTCDALTX0101VFHN31" + }, + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "UCPE", + "modelVersion": 1 + }, + "subscriberInfo": { + "globalSubscriberId": "83031", + "subscriberName": "Fern Hill Real Estate LLC 31" + }, + "requestParameters": { + "ucpeInfo": { + "ucpeHostName": "USOSTCDALTX0101UJZZ31", + "ucpeAliasHostName": "SHELLUCPE31", + "ucpeActivationCode": "ASD-987-M31", + "ucpePartNumber": "FG-VM00*", + "outOfBandManagementModem": "BROADBAND", + "internetTopology": "IVLAN", + "wanList": [ + { "wanInfo": { + "wanPortNumber": "WAN1", + "wanType": "AVPN", + "circuitId": "BT/SLIR/70911", + "dualMode": "Active", + "transportManagementOption": "ATT", + "transportProviderName": "ATT", + "mediaType": "ELECTRICAL", + "interfaceType": "1000BASE-T", + "transportVendorTotalBandwidth": "100" + }}, + { "wanInfo": { + "wanPortNumber": "WAN2", + "wanType": "AVPN", + "circuitId": "AS/KRFN/34611", + "dualMode": "Active", + "transportManagementOption": "ATT", + "transportProviderName": "ATT", + "mediaType": "MMF", + "interfaceType": "10/100/1000BASE-T", + "transportVendorTotalBandwidth": "10000" + }} + ] + } + } + } +} -- cgit 1.2.3-korg