From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../mso/adapter_utils/tests/CloudConfigTest.java | 173 +++++++ .../adapter_utils/tests/MsoCommonUtilsTest.java | 130 +++++ .../mso/adapter_utils/tests/MsoHeatUtilsTest.java | 91 ++++ .../tests/MsoHeatUtilsWithUpdateTest.java | 132 +++++ .../openecomp/mso/cloud/CloudIdentityESTest.java | 400 +++++++++++++++ .../org/openecomp/mso/cloud/CloudIdentityTest.java | 59 +++ .../org/openecomp/mso/cloud/CloudSiteESTest.java | 315 ++++++++++++ .../mso/cloud/CloudSiteESTestscaffolding.java | 150 ++++++ .../mso/openstack/beans/MsoTenantESTest.java | 83 +++ .../beans/MsoTenantESTestscaffolding.java | 78 +++ .../mso/openstack/beans/NetworkInfoESTest.java | 247 +++++++++ .../beans/NetworkInfoESTestscaffolding.java | 92 ++++ .../mso/openstack/beans/NetworkRollbackESTest.java | 303 +++++++++++ .../beans/NetworkRollbackESTestscaffolding.java | 79 +++ .../openecomp/mso/openstack/beans/PoolESTest.java | 70 +++ .../mso/openstack/beans/PoolESTestscaffolding.java | 78 +++ .../mso/openstack/beans/SubnetESTest.java | 221 ++++++++ .../openstack/beans/SubnetESTestscaffolding.java | 79 +++ .../mso/openstack/beans/VnfRollbackESTest.java | 403 +++++++++++++++ .../beans/VnfRollbackESTestscaffolding.java | 79 +++ .../exceptions/MsoAdapterExceptionESTest.java | 24 + .../MsoAdapterExceptionESTestscaffolding.java | 87 ++++ .../exceptions/MsoCloudSiteNotFoundESTest.java | 30 ++ .../MsoCloudSiteNotFoundESTestscaffolding.java | 87 ++++ .../openstack/exceptions/MsoExceptionESTest.java | 77 +++ .../exceptions/MsoExceptionESTestscaffolding.java | 101 ++++ .../openstack/exceptions/MsoIOExceptionESTest.java | 24 + .../MsoIOExceptionESTestscaffolding.java | 87 ++++ .../exceptions/MsoNetworkAlreadyExistsESTest.java | 23 + .../MsoNetworkAlreadyExistsESTestscaffolding.java | 89 ++++ .../exceptions/MsoNetworkNotFoundESTest.java | 23 + .../MsoNetworkNotFoundESTestscaffolding.java | 89 ++++ .../exceptions/MsoOpenstackExceptionESTest.java | 32 ++ .../MsoOpenstackExceptionESTestscaffolding.java | 87 ++++ .../exceptions/MsoStackAlreadyExistsESTest.java | 23 + .../MsoStackAlreadyExistsESTestscaffolding.java | 89 ++++ .../exceptions/MsoStackNotFoundESTest.java | 23 + .../MsoStackNotFoundESTestscaffolding.java | 89 ++++ .../exceptions/MsoTenantAlreadyExistsESTest.java | 23 + .../MsoTenantAlreadyExistsESTestscaffolding.java | 89 ++++ .../exceptions/MsoTenantNotFoundESTest.java | 23 + .../MsoTenantNotFoundESTestscaffolding.java | 89 ++++ .../utils/MsoHeatEnvironmentEntryESTest.java | 562 +++++++++++++++++++++ .../utils/MsoHeatEnvironmentParameterESTest.java | 129 +++++ ...oHeatEnvironmentParameterESTestscaffolding.java | 78 +++ .../utils/MsoHeatEnvironmentResourceESTest.java | 129 +++++ ...soHeatEnvironmentResourceESTestscaffolding.java | 78 +++ 47 files changed, 5546 insertions(+) create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java (limited to 'adapters/mso-adapter-utils/src/test/java/org/openecomp') diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java new file mode 100644 index 0000000000..8632d02164 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java @@ -0,0 +1,173 @@ +/*- + * ============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.adapter_utils.tests; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.BeforeClass; +import org.junit.Test; +import java.util.Map; +import org.openecomp.mso.cloud.CloudConfig; +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.CloudSite; + + +/** + * This class implements test methods of the CloudConfig features. + * + * + */ +public class CloudConfigTest { + + private static CloudConfig con; + private static CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); + + public CloudConfigTest () { + + } + + /** + * This method is called before any test occurs. + * It creates a fake tree from scratch + */ + @BeforeClass + public static final void prepare () { + ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); + String config = classLoader.getResource("cloud_config.json").toString().substring(5); + + cloudConfigFactory.initializeCloudConfig(config,1); + con = cloudConfigFactory.getCloudConfig(); + } + + /** + * This method implements a test for the getCloudConfig method. + */ + @Test + public final void testGetCloudConfig () { + assertNotNull(con); + } + + /** + * This method implements a test for the getCloudSites method. + */ + @Test + public final void testGetCloudSites () { + Map siteMap = con.getCloudSites(); + assertNotNull(siteMap); + + CloudSite site1 = siteMap.get("MT"); + CloudSite site2 = siteMap.get("DAN"); + CloudSite site3 = siteMap.get("MTINJVCC101"); + + assertEquals (site1.getRegionId(), "regionOne"); + assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); + assertEquals (site2.getRegionId(), "RegionOne"); + assertEquals (site2.getIdentityServiceId(), "DAN_KEYSTONE"); + assertEquals (site3.getRegionId(), "regionTwo"); + assertEquals (site3.getIdentityServiceId(), "MTINJVCC101_DCP"); + + } + + + /** + * This method implements a test for the getIdentityServices method. + */ + @Test + public final void testGetIdentityServices () { + Map identityMap = con.getIdentityServices (); + assertNotNull(identityMap); + + CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); + CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE"); + CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); + CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); + +// assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0"); +// assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0"); + assertEquals (identity1.getMsoId(), "john"); + assertEquals (identity1.getMsoPass(), "changeme"); + assertEquals (identity1.getAdminTenant(), "admin"); + assertEquals (identity1.getMemberRole(), "_member_"); + assertEquals (identity1.hasTenantMetadata(), false); + +// assertEquals (identity2.getKeystoneUrl(), "http://localhost:5000/v2.0"); +// assertEquals (identity2.getIdentityUrl(), "http://localhost:5000/v2.0"); + assertEquals (identity2.getMsoId(), "mockId"); + assertEquals (identity2.getMsoPass(), "stack123"); + assertEquals (identity2.getAdminTenant(), "service"); + assertEquals (identity2.getMemberRole(), "_member_"); + assertEquals (identity2.hasTenantMetadata(), false); + +// assertEquals (identity3.getKeystoneUrl(), "http://localhost:5000/v2.0"); +// assertEquals (identity3.getIdentityUrl(), "http://localhost:5000/v2.0"); + assertEquals (identity3.getMsoId(), "mockIdToo"); + assertEquals (identity3.getMsoPass(), "AICG@mm@@2015"); + assertEquals (identity3.getAdminTenant(), "service"); + assertEquals (identity3.getMemberRole(), "admin"); + assertEquals (identity3.hasTenantMetadata(), true); + +// assertEquals (identity4.getKeystoneUrl(), "https://localhost:5000/v2.0"); +// assertEquals (identity4.getIdentityUrl(), "https://localhost:5000/v2.0"); + assertEquals (identity4.getMsoId(), "mockIdToo"); + assertEquals (identity4.getMsoPass(), "2315QRS2015srq"); + assertEquals (identity4.getAdminTenant(), "service"); + assertEquals (identity4.getMemberRole(), "admin"); + assertEquals (identity4.hasTenantMetadata(), true); + + } + + /** + * This method implements a test for the getCloudSite method. + */ + @Test + public final void testGetCloudSite () { + CloudSite site1 = con.getCloudSite("MT"); + assertNotNull(site1); + assertEquals (site1.getRegionId(), "regionOne"); + assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); + + + + } + + /** + * This method implements a test for the getIdentityService method. + */ + @Test + public final void testGetIdentityService () { + CloudIdentity identity1 = con.getIdentityService("MT_KEYSTONE"); + assertNotNull(identity1); +// assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0"); +// assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0"); + assertEquals (identity1.getMsoId(), "john"); + assertEquals (identity1.getMsoPass(), "changeme"); + assertEquals (identity1.getAdminTenant(), "admin"); + assertEquals (identity1.getMemberRole(), "_member_"); + assertEquals (identity1.hasTenantMetadata(), false); + + CloudIdentity identity2 = con.getIdentityService("Test"); + assertNull(identity2); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java new file mode 100644 index 0000000000..9f17283786 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java @@ -0,0 +1,130 @@ +/*- + * ============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.adapter_utils.tests; + + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; + +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.openstack.exceptions.MsoAdapterException; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.openecomp.mso.openstack.exceptions.MsoIOException; +import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; +import org.openecomp.mso.openstack.utils.MsoCommonUtils; +import org.openecomp.mso.properties.MsoJavaProperties; +import org.openecomp.mso.properties.MsoPropertiesException; +import org.openecomp.mso.properties.MsoPropertiesFactory; +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; + + +/** + * This class implements test methods of the MsoCommonUtils + * + * + */ +public class MsoCommonUtilsTest extends MsoCommonUtils { + + public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + + @Test + public final void testExecuteAndRecordOpenstackRequest () { + OpenStackRequest openstackRequest = Mockito.mock(OpenStackRequest.class); + Mockito.when(openstackRequest.endpoint()).thenReturn("localhost"); + Mockito.when(openstackRequest.path()).thenReturn("/test"); + //TODO:Must try a real connection + assertNull(super.executeAndRecordOpenstackRequest (openstackRequest)); + + } + + @Test + public final void testKeystoneErrorToMsoException () { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = super.keystoneErrorToMsoException (openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + + MsoException me2 = super.keystoneErrorToMsoException (openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + + } + + @Test + public final void testHeatExceptionToMsoException () { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = super.heatExceptionToMsoException (openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + + MsoException me2 = super.heatExceptionToMsoException (openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + } + + @Test + public final void testNeutronExceptionToMsoException () { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = super.neutronExceptionToMsoException (openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + MsoException me2 = super.neutronExceptionToMsoException (openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + } + + @Test + public final void testRuntimeExceptionToMsoException () { + RuntimeException re = new RuntimeException ("runtime"); + MsoException me = super.runtimeExceptionToMsoException (re, "ContextError"); + + assertTrue (me instanceof MsoAdapterException); + assertTrue("ContextError".equals(me.getContext())); + assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory())); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java new file mode 100644 index 0000000000..6f8a6e93d8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java @@ -0,0 +1,91 @@ +/*- + * ============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.adapter_utils.tests; + +import java.util.HashMap; + +import org.junit.BeforeClass; +import org.junit.Test; + +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.openstack.exceptions.MsoAdapterException; +import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.exceptions.MsoIOException; +import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists; +import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound; +import org.openecomp.mso.openstack.utils.MsoCommonUtils; +import org.openecomp.mso.openstack.utils.MsoHeatUtils; +import org.openecomp.mso.properties.MsoPropertiesFactory; + + + +/** + * This class implements test methods of the MsoHeatUtils + * + * + */ +public class MsoHeatUtilsTest extends MsoCommonUtils { + public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); + public static MsoHeatUtils msoHeatUtils; + + @BeforeClass + public static final void loadClasses() { + ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); + String config = classLoader.getResource("cloud_config.json").toString().substring(5); + cloudConfigFactory.initializeCloudConfig(config, 1); + msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory); + } + + @Test + public final void testCreateStackBadCloudConfig () { + try { + msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); + } catch (MsoException e) { + + } + + } + + @Test + public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); + } catch (MsoIOException e) { + + } + + } + + @Test + public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); + } catch (MsoIOException e) { + + } + + } + + + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java new file mode 100644 index 0000000000..a5d46da614 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java @@ -0,0 +1,132 @@ +/*- + * ============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.adapter_utils.tests; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import org.openecomp.mso.cloud.CloudConfig; +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.CloudSite; +import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.exceptions.MsoIOException; +import org.openecomp.mso.openstack.utils.MsoHeatUtilsWithUpdate; +import org.openecomp.mso.properties.MsoPropertiesFactory; +import com.woorea.openstack.base.client.OpenStackConnectException; + +@RunWith(MockitoJUnitRunner.class) +public class MsoHeatUtilsWithUpdateTest { + + public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); + + @Mock + CloudConfig cloudConfig; + @InjectMocks + MsoHeatUtilsWithUpdate util=new MsoHeatUtilsWithUpdate("NO_PROP",msoPropertiesFactory,cloudConfigFactory); + + private CloudSite cloudSite; + + @Before + public void init () { + cloudSite = new CloudSite (); + cloudSite.setId ("cloud"); + CloudIdentity cloudIdentity = new CloudIdentity (); + cloudSite.setIdentityService (cloudIdentity); + cloudIdentity.setKeystoneUrl ("toto"); + cloudIdentity.setMsoPass (CloudIdentity.encryptPassword ("mockId")); + + when (cloudConfig.getCloudSite ("cloud")).thenReturn (cloudSite); + when (cloudConfig.getCloudSite ("none")).thenReturn (null); + } + + @Test + public void testUpdateStack () { + // Heat heat = Mockito.mock (Heat.class); + Map stackInputs = new HashMap <> (); + try { + util.updateStack ("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); + } catch (MsoException e) { + if (e instanceof MsoCloudSiteNotFound) { + // Ok + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment"); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java new file mode 100644 index 0000000000..69fbb2625d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java @@ -0,0 +1,400 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:37:20 GMT 2016 + */ + +package org.openecomp.mso.cloud; + +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.evosuite.runtime.PrivateAccess; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class CloudIdentityESTest { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMsoId("ga-cj*/"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setTenantMetadata(true); + boolean boolean0 = cloudIdentity0.hasTenantMetadata(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMsoPass(""); + String string0 = cloudIdentity0.getMsoPass(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMsoId("hz4IjQ&in.t^IC|"); + String string0 = cloudIdentity0.getMsoId(); + assertEquals("hz4IjQ&in.t^IC|", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMemberRole("Exception in encryptPassword"); + String string0 = cloudIdentity0.getMemberRole(); + assertEquals("Exception in encryptPassword", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setIdentityUrl("ASDC_ARTIFACT_ALREADY_DEPLOYED"); + String string0 = cloudIdentity0.getIdentityUrl(); + assertEquals("ASDC_ARTIFACT_ALREADY_DEPLOYED", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + CloudIdentity.IdentityServerType cloudIdentity_IdentityServerType0 = CloudIdentity.IdentityServerType.KEYSTONE; + PrivateAccess.setVariable((Class) CloudIdentity.class, cloudIdentity0, "identityServerType", (Object) cloudIdentity_IdentityServerType0); + String string0 = cloudIdentity0.getIdentityServerTypeAsString(); + assertEquals("KEYSTONE", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setId(""); + String string0 = cloudIdentity0.getId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setAdminTenant("0hh5nz?kd3N,FTKBX"); + String string0 = cloudIdentity0.getAdminTenant(); + assertEquals("0hh5nz?kd3N,FTKBX", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setTenantMetadata(true); + CloudIdentity cloudIdentity1 = cloudIdentity0.clone(); + assertTrue(cloudIdentity1.equals((Object)cloudIdentity0)); + assertTrue(cloudIdentity1.hasTenantMetadata()); + assertNotSame(cloudIdentity1, cloudIdentity0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setTenantMetadata(false); + CloudIdentity cloudIdentity1 = cloudIdentity0.clone(); + assertFalse(cloudIdentity1.hasTenantMetadata()); + assertTrue(cloudIdentity1.equals((Object)cloudIdentity0)); + assertNotSame(cloudIdentity1, cloudIdentity0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMsoPass("0LAxuQ0#K,Ma"); + // Undeclared exception! + try { + cloudIdentity0.getMsoPass(); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // For input string: \"0L\" + // + verifyException("java.lang.NumberFormatException", e); + } + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + // Undeclared exception! + try { + cloudIdentity0.getKeystoneUrl(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.cloud.CloudIdentity", e); + } + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + // Undeclared exception! + try { + CloudIdentity.encryptPassword((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + CloudIdentity cloudIdentity1 = cloudIdentity0.clone(); + assertTrue(cloudIdentity1.equals((Object)cloudIdentity0)); + + PrivateAccess.setVariable((Class) CloudIdentity.class, cloudIdentity1, "msoPass", (Object) "0~=?Wm,~42b4:K"); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMemberRole("r"); + CloudIdentity cloudIdentity1 = new CloudIdentity(); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + CloudIdentity cloudIdentity1 = cloudIdentity0.clone(); + assertTrue(cloudIdentity1.equals((Object)cloudIdentity0)); + + cloudIdentity1.setMemberRole("RA_SET_CALLBACK_AUTH_EXC"); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMemberRole("r"); + CloudIdentity cloudIdentity1 = cloudIdentity0.clone(); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity1); + assertNotSame(cloudIdentity1, cloudIdentity0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + Object object0 = new Object(); + boolean boolean0 = cloudIdentity0.equals(object0); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + boolean boolean0 = cloudIdentity0.equals((Object) null); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMsoPass("9Y#4-v1Fu27keLW"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setMemberRole("ASDC_GENERAL_METRICS"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setIdentityUrl("g9+j0@{H}S|"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setId("FSmZDF:2*!OtMq!i"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setKeystoneUrl("VdON&(o*x/W!"); + assertNull(cloudIdentity0.getMemberRole()); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getKeystoneUrl("A9Z Ol `I1^y]F[EC0", ""); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getMemberRole(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + // Undeclared exception! + try { + cloudIdentity0.getIdentityServerTypeAsString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.cloud.CloudIdentity", e); + } + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setIdentityUrl("com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES"); + CloudIdentity cloudIdentity1 = new CloudIdentity(); + boolean boolean0 = cloudIdentity0.equals(cloudIdentity1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setTenantMetadata(false); + cloudIdentity0.hashCode(); + assertFalse(cloudIdentity0.hasTenantMetadata()); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.setAdminTenant("0hh5nz?kd3N,FTKBX"); + cloudIdentity0.hashCode(); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getAdminTenant(); + assertNull(string0); + + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getMsoId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudIdentity0.getIdentityServerType(); + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + // Undeclared exception! + try { + cloudIdentity0.getMsoPass(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.utils.CryptoUtils", e); + } + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + // Undeclared exception! + try { + cloudIdentity0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.cloud.CloudIdentity", e); + } + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + // Undeclared exception! + try { + cloudIdentity0.hasTenantMetadata(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.cloud.CloudIdentity", e); + } + } + + @Test(timeout = 4000) + public void test42() throws Throwable { + CloudIdentity cloudIdentity0 = new CloudIdentity(); + String string0 = cloudIdentity0.getIdentityUrl(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test43() throws Throwable { + String string0 = CloudIdentity.encryptPassword("jaR\"aJmqpa>(&"); + assertEquals("718A16EDF9EA61E9350A07703082D5B5", string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java new file mode 100644 index 0000000000..377a7243ca --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java @@ -0,0 +1,59 @@ +/*- + * ============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.cloud; + + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + + +public class CloudIdentityTest { + + @Test + public final void testCloudIdentity () { + CloudIdentity id = new CloudIdentity (); + id.setAdminTenant ("AdminTenant"); + id.setId ("id"); +// id.setKeystoneUrl ("keystone"); + id.setIdentityUrl ("keystone"); + id.setMemberRole ("member"); + id.setMsoId ("msoId"); + id.setMsoPass (CloudIdentity.encryptPassword ("password")); + id.setTenantMetadata (true); + + assertTrue (id.getAdminTenant ().equals ("AdminTenant")); + assertTrue (id.getId ().equals ("id")); +// assertTrue (id.getKeystoneUrl ().equals ("keystone")); + assertTrue (id.getMemberRole ().equals ("member")); + assertTrue (id.getMsoId ().equals ("msoId")); + assertTrue (id.getMsoPass ().equals ("password")); + assertTrue (id.hasTenantMetadata ()); +// assertTrue (id.toString ().contains ("keystone")); + } + + @Test + public final void testEncryption () { + String encrypted = CloudIdentity.encryptPassword ("password"); + assertTrue (encrypted != null); + assertTrue (!encrypted.equals ("password")); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java new file mode 100644 index 0000000000..68bccfcc1b --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java @@ -0,0 +1,315 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:42:36 GMT 2016 + */ + +package org.openecomp.mso.cloud; + +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.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 CloudSiteESTest extends CloudSiteESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setAic_version("-t"); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setRegionId("CloudSite: id="); + String string0 = cloudSite0.getRegionId(); + assertEquals("CloudSite: id=", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setRegionId(""); + String string0 = cloudSite0.getRegionId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "identityServiceId", (Object) "PUBLIC"); + String string0 = cloudSite0.getIdentityServiceId(); + assertEquals("PUBLIC", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudSite0.setIdentityService(cloudIdentity0); + cloudIdentity0.setTenantMetadata(false); + CloudIdentity cloudIdentity1 = cloudSite0.getIdentityService(); + assertNull(cloudIdentity1.getAdminTenant()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setId(""); + String string0 = cloudSite0.getId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setClli("N;w7*-)9\"t|T/jCa"); + String string0 = cloudSite0.getClli(); + assertEquals("N;w7*-)9\"t|T/jCa", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setClli(""); + String string0 = cloudSite0.getClli(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setAic_version("v&K[by0"); + String string0 = cloudSite0.getAic_version(); + assertEquals("v&K[by0", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setAic_version(""); + String string0 = cloudSite0.getAic_version(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = mock(CloudIdentity.class, new ViolatedAssumptionAnswer()); + doReturn((CloudIdentity) null).when(cloudIdentity0).clone(); + cloudSite0.setIdentityService(cloudIdentity0); + CloudSite cloudSite1 = cloudSite0.clone(); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertFalse(boolean0); + assertFalse(cloudSite1.equals((Object)cloudSite0)); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudSite cloudSite1 = new CloudSite(); + assertTrue(cloudSite1.equals((Object)cloudSite0)); + + cloudSite1.setClli("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null"); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudSite0.setIdentityService(cloudIdentity0); + CloudSite cloudSite1 = cloudSite0.clone(); + assertTrue(cloudSite1.equals((Object)cloudSite0)); + + cloudSite1.setAic_version(""); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertFalse(cloudSite1.equals((Object)cloudSite0)); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudSite0.setIdentityService(cloudIdentity0); + CloudSite cloudSite1 = cloudSite0.clone(); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertNotSame(cloudSite1, cloudSite0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setRegionId("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null"); + CloudSite cloudSite1 = new CloudSite(); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertFalse(cloudSite1.equals((Object)cloudSite0)); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudSite0.setIdentityService(cloudIdentity0); + CloudSite cloudSite1 = cloudSite0.clone(); + assertTrue(cloudSite1.equals((Object)cloudSite0)); + + cloudSite1.setId("Tx;$hjj"); + boolean boolean0 = cloudSite1.equals(cloudSite0); + assertFalse(boolean0); + assertFalse(cloudSite1.equals((Object)cloudSite0)); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + Object object0 = new Object(); + boolean boolean0 = cloudSite0.equals(object0); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + boolean boolean0 = cloudSite0.equals((Object) null); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + boolean boolean0 = cloudSite0.equals(cloudSite0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "identityServiceId", (Object) ""); + CloudSite cloudSite1 = new CloudSite(); + boolean boolean0 = cloudSite0.equals(cloudSite1); + assertFalse(boolean0); + assertFalse(cloudSite1.equals((Object)cloudSite0)); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "clli", (Object) "AgBkO0S\"V'R'"); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "regionId", (Object) "`V+.b PU'3:EbS"); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "identityServiceId", (Object) "PUBLIC"); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + PrivateAccess.setVariable((Class) CloudSite.class, cloudSite0, "id", (Object) "PUBLIC"); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.getIdentityServiceId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.toString(); + assertEquals("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null", string0); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.getAic_version(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = new CloudIdentity(); + cloudSite0.setIdentityService(cloudIdentity0); + cloudSite0.hashCode(); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.getClli(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.getId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + String string0 = cloudSite0.getRegionId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + cloudSite0.setId("Tx;$hjj"); + String string0 = cloudSite0.getId(); + assertEquals("Tx;$hjj", string0); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + CloudIdentity cloudIdentity0 = cloudSite0.getIdentityService(); + assertNull(cloudIdentity0); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + CloudSite cloudSite0 = new CloudSite(); + // Undeclared exception! + try { + cloudSite0.clone(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.cloud.CloudSite", e); + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java new file mode 100644 index 0000000000..48e800ff5b --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java @@ -0,0 +1,150 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:42:36 GMT 2016 + */ + +package org.openecomp.mso.cloud; + +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 CloudSiteESTestscaffolding { + + @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.cloud.CloudSite"; + 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(CloudSiteESTestscaffolding.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.cloud.CloudSite", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.cloud.CloudIdentity$IdentityServerType", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "com.att.eelf.configuration.EELFLogger", + "com.att.eelf.i18n.EELFMsgs", + "org.openecomp.mso.openstack.exceptions.MsoException", + "com.att.eelf.configuration.EELFLogger$Level", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "com.att.eelf.configuration.SLF4jWrapper", + "com.att.eelf.i18n.EELFResourceManager", + "org.openecomp.mso.cloud.CloudIdentity" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CloudSiteESTestscaffolding.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", + "org.apache.xerces.jaxp.SAXParserFactoryImpl", + "org.apache.xerces.jaxp.SAXParserImpl", + "org.apache.xerces.parsers.XMLParser", + "org.apache.xerces.parsers.AbstractSAXParser", + "org.apache.xerces.parsers.SAXParser", + "org.apache.xerces.parsers.ObjectFactory", + "org.apache.xerces.util.ParserConfigurationSettings", + "org.apache.xerces.parsers.XML11Configuration", + "org.apache.xerces.parsers.XIncludeAwareParserConfiguration", + "org.apache.xerces.util.SymbolTable", + "org.apache.xerces.impl.XMLEntityManager", + "org.apache.xerces.util.AugmentationsImpl$SmallContainer", + "org.apache.xerces.impl.XMLEntityManager$ByteBufferPool", + "org.apache.xerces.impl.XMLEntityManager$CharacterBufferPool", + "org.apache.xerces.impl.XMLEntityScanner$1", + "org.apache.xerces.impl.XMLEntityScanner", + "org.apache.xerces.impl.XMLErrorReporter", + "org.apache.xerces.impl.XMLScanner", + "org.apache.xerces.impl.XMLDocumentFragmentScannerImpl", + "org.apache.xerces.impl.XMLDocumentScannerImpl", + "org.apache.xerces.util.XMLStringBuffer", + "org.apache.xerces.util.XMLAttributesImpl", + "org.apache.xerces.impl.XMLDTDScannerImpl", + "org.apache.xerces.impl.dtd.XMLDTDProcessor", + "org.apache.xerces.impl.dtd.XMLDTDValidator", + "org.apache.xerces.impl.validation.ValidationState", + "org.apache.xerces.impl.dtd.XMLElementDecl", + "org.apache.xerces.impl.dtd.XMLSimpleType", + "org.apache.xerces.impl.dv.DTDDVFactory", + "org.apache.xerces.impl.dv.ObjectFactory", + "org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl", + "org.apache.xerces.impl.XMLVersionDetector", + "org.apache.xerces.impl.msg.XMLMessageFormatter", + "org.apache.xerces.impl.io.UTF8Reader", + "org.apache.xerces.util.XMLSymbols", + "org.apache.xerces.xni.NamespaceContext", + "org.apache.xerces.util.XMLChar", + "org.apache.xerces.impl.Constants", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.cloud.CloudIdentity", + "org.openecomp.mso.utils.CryptoUtils", + "org.openecomp.mso.logger.MsoAlarmLogger", + "org.openecomp.mso.openstack.utils.MsoCommonUtils" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java new file mode 100644 index 0000000000..241ca88a1d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java @@ -0,0 +1,83 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:56:50 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.Map; +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 MsoTenantESTest extends MsoTenantESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant("P<5j-:=G4zf", "P<5j-:=G4zf", (Map) null); + String string0 = msoTenant0.getTenantName(); + assertEquals("P<5j-:=G4zf", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant("", "", (Map) null); + String string0 = msoTenant0.getTenantName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + String string0 = msoTenant0.getTenantName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + Map map0 = msoTenant0.getMetadata(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant("", "SsK{%:", (Map) null); + String string0 = msoTenant0.getTenantId(); + assertEquals("", string0); + assertEquals("SsK{%:", msoTenant0.getTenantName()); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + msoTenant0.setTenantId("9A"); + String string0 = msoTenant0.getTenantId(); + assertEquals("9A", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + msoTenant0.setMetadata((Map) null); + assertNull(msoTenant0.getTenantName()); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + msoTenant0.setTenantName("9A"); + assertNull(msoTenant0.getTenantId()); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + MsoTenant msoTenant0 = new MsoTenant(); + String string0 = msoTenant0.getTenantId(); + assertNull(string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java new file mode 100644 index 0000000000..0ac4893ee8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:56:50 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 MsoTenantESTestscaffolding { + + @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.openstack.beans.MsoTenant"; + 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(MsoTenantESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.beans.MsoTenant" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java new file mode 100644 index 0000000000..9c157252ed --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java @@ -0,0 +1,247 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:44:14 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; +import java.util.List; +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 NetworkInfoESTest extends NetworkInfoESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setVlans((List) null); + List list0 = networkInfo0.getVlans(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Network network0 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(network0).getId(); + doReturn((String) null).when(network0).getName(); + doReturn((String) null).when(network0).getProviderPhysicalNetwork(); + doReturn((List) null).when(network0).getSegments(); + doReturn((String) null).when(network0).getStatus(); + doReturn((List) null).when(network0).getSubnets(); + NetworkInfo networkInfo0 = new NetworkInfo(network0); + List list0 = networkInfo0.getSubnets(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setShared("Network [id="); + String string0 = networkInfo0.getShared(); + assertEquals("Network [id=", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setProvider((String) null); + String string0 = networkInfo0.getProvider(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setProvider("ERROR"); + String string0 = networkInfo0.getProvider(); + assertEquals("ERROR", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setId((String) null); + String string0 = networkInfo0.getId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + NetworkStatus networkStatus0 = NetworkStatus.DOWN; + NetworkInfo networkInfo0 = new NetworkInfo("IghhGdNW B*}", networkStatus0); + String string0 = networkInfo0.getId(); + assertEquals("IghhGdNW B*}", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + Network network0 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(network0).getId(); + doReturn((String) null).when(network0).getName(); + doReturn((String) null).when(network0).getProviderPhysicalNetwork(); + doReturn((List) null).when(network0).getSegments(); + doReturn((String) null).when(network0).getStatus(); + doReturn((List) null).when(network0).getSubnets(); + NetworkInfo networkInfo0 = new NetworkInfo(network0); + List list0 = networkInfo0.getSubnets(); + Network network1 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(network1).getId(); + doReturn((String) null).when(network1).getName(); + doReturn((String) null).when(network1).getProviderPhysicalNetwork(); + doReturn((List) null).when(network1).getSegments(); + doReturn("uxR^({\"", (String) null).when(network1).getStatus(); + doReturn(list0).when(network1).getSubnets(); + NetworkInfo networkInfo1 = new NetworkInfo(network1); + assertNull(networkInfo1.getName()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + Network network0 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn(", segments: ").when(network0).getId(); + doReturn("ACTIVE").when(network0).getName(); + doReturn("l1~gC_#a'H,#*").when(network0).getProviderNetworkType(); + doReturn("ACTIVE", "").when(network0).getProviderPhysicalNetwork(); + doReturn("ERROR", "ERROR", "%<3T-").when(network0).getStatus(); + doReturn((List) null).when(network0).getSubnets(); + NetworkInfo networkInfo0 = new NetworkInfo(network0); + networkInfo0.getStatus(); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + Network network0 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn(", segments: ").when(network0).getId(); + doReturn("ACTIVE").when(network0).getName(); + doReturn((String) null).when(network0).getProviderNetworkType(); + doReturn("ACTIVE", (String) null).when(network0).getProviderPhysicalNetwork(); + doReturn("ERROR", (String) null).when(network0).getStatus(); + NetworkInfo networkInfo0 = null; + try { + networkInfo0 = new NetworkInfo(network0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo((Network) null); + assertEquals("", networkInfo0.getId()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + String string0 = networkInfo0.toString(); + assertEquals("Network: name=,id=,status=UNKNOWN,provider=,vlans=[],subnets=[],shared=", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + NetworkStatus networkStatus0 = NetworkStatus.NOTFOUND; + networkInfo0.setStatus(networkStatus0); + assertEquals("", networkInfo0.getShared()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + NetworkStatus networkStatus0 = NetworkStatus.UNKNOWN; + NetworkInfo networkInfo0 = new NetworkInfo((String) null, networkStatus0); + String string0 = networkInfo0.getName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setShared((String) null); + String string0 = networkInfo0.getShared(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + String string0 = networkInfo0.getShared(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + List list0 = networkInfo0.getSubnets(); + Network network0 = mock(Network.class, new ViolatedAssumptionAnswer()); + doReturn("R65k@>rbu`lzb#").when(network0).getId(); + doReturn("ERROR").when(network0).getName(); + doReturn("DOWN").when(network0).getProviderNetworkType(); + doReturn("u1Z(%z~k-ao5#y", "R65k@>rbu`lzb#").when(network0).getProviderPhysicalNetwork(); + doReturn("R65k@>rbu`lzb#", "R65k@>rbu`lzb#").when(network0).getStatus(); + doReturn(list0).when(network0).getSubnets(); + NetworkInfo networkInfo1 = new NetworkInfo(network0); + networkInfo1.getName(); + assertEquals("R65k@>rbu`lzb#", networkInfo1.getProvider()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + List list0 = networkInfo0.getVlans(); + networkInfo0.setVlans(list0); + assertEquals("", networkInfo0.getProvider()); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setName(""); + assertEquals(NetworkStatus.UNKNOWN, networkInfo0.getStatus()); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + networkInfo0.setSubnets((List) null); + assertEquals("", networkInfo0.getShared()); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + NetworkStatus networkStatus0 = networkInfo0.getStatus(); + assertEquals(NetworkStatus.UNKNOWN, networkStatus0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + String string0 = networkInfo0.getProvider(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + String string0 = networkInfo0.getId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + NetworkInfo networkInfo0 = new NetworkInfo(); + String string0 = networkInfo0.getName(); + assertEquals("", string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java new file mode 100644 index 0000000000..0c87ca9016 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java @@ -0,0 +1,92 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:44:14 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 NetworkInfoESTestscaffolding { + + @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.openstack.beans.NetworkInfo"; + 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(NetworkInfoESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.annotate.JacksonAnnotation", + "com.woorea.openstack.quantum.model.Network", + "org.codehaus.jackson.annotate.JsonIgnoreProperties", + "com.woorea.openstack.quantum.model.Segment", + "org.openecomp.mso.openstack.beans.NetworkInfo", + "org.openecomp.mso.openstack.beans.NetworkStatus", + "com.woorea.openstack.quantum.model.Network$NetworkType", + "org.codehaus.jackson.map.annotate.JsonRootName" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(NetworkInfoESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.beans.NetworkStatus", + "org.openecomp.mso.openstack.beans.NetworkInfo", + "com.woorea.openstack.quantum.model.Network" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java new file mode 100644 index 0000000000..bad2bde0af --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java @@ -0,0 +1,303 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:55:12 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; +import org.openecomp.mso.entity.MsoRequest; + +import java.util.List; +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 NetworkRollbackESTest extends NetworkRollbackESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkStackId("H/r!m+_NT$?ed$IPcLD"); + networkRollback0.setNeutronNetworkId("H/r!m+_NT$?ed$IPcLD"); + MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); + doReturn((String) null, (String) null, (String) null).when(msoRequest0).toString(); + networkRollback0.setNetworkStackId(""); + networkRollback0.setMsoRequest((MsoRequest) null); + networkRollback0.setMsoRequest(msoRequest0); + networkRollback0.toString(); + networkRollback0.setNeutronNetworkId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]"); + networkRollback0.getVlans(); + networkRollback0.setCloudId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]"); + networkRollback0.setNetworkType("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]"); + networkRollback0.toString(); + networkRollback0.setCloudId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]"); + networkRollback0.setTenantId("80\u0002<]~y|x(#fl"); + networkRollback0.setCloudId("=:U\"]"); + networkRollback0.toString(); + networkRollback0.getVlans(); + networkRollback0.toString(); + networkRollback0.getVlans(); + networkRollback0.getVlans(); + networkRollback0.getVlans(); + networkRollback0.setVlans((List) null); + networkRollback0.toString(); + networkRollback0.getMsoRequest(); + networkRollback0.getVlans(); + networkRollback0.toString(); + networkRollback0.getMsoRequest(); + networkRollback0.getVlans(); + networkRollback0.getMsoRequest(); + networkRollback0.getVlans(); + List list0 = networkRollback0.getVlans(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkType((String) null); + networkRollback0.getMsoRequest(); + networkRollback0.setMsoRequest((MsoRequest) null); + networkRollback0.setNetworkId(""); + networkRollback0.setTenantId(""); + networkRollback0.getNetworkId(); + networkRollback0.setNeutronNetworkId(""); + networkRollback0.setCloudId("O;On"); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setCloudId("C5FS|V@CMBag"); + networkRollback0.getVlans(); + networkRollback0.setVlans((List) null); + networkRollback0.getPhysicalNetwork(); + networkRollback0.setVlans((List) null); + networkRollback0.getNeutronNetworkId(); + networkRollback0.setNetworkType("C5FS|V@CMBag"); + networkRollback0.getNetworkType(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkId(", networkName="); + networkRollback0.setNetworkStackId("u)"); + networkRollback0.setNetworkId("u)"); + networkRollback0.setNetworkId(", networkName="); + networkRollback0.getNetworkStackId(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkType("V3$f~dKduUu0"); + networkRollback0.setNetworkType(""); + networkRollback0.setTenantId(""); + networkRollback0.getPhysicalNetwork(); + networkRollback0.getVlans(); + networkRollback0.getNetworkType(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setTenantId("Lu#)!pt2p=<#T."); + networkRollback0.getTenantId(); + networkRollback0.setNetworkStackId("Lu#)!pt2p=<#T."); + networkRollback0.getNeutronNetworkId(); + networkRollback0.setTenantId("Lu#)!pt2p=<#T."); + networkRollback0.setNetworkStackId((String) null); + String string0 = networkRollback0.toString(); + assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=Lu#)!pt2p=<#T., cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getMsoRequest(); + networkRollback0.setMsoRequest((MsoRequest) null); + String string0 = networkRollback0.toString(); + assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0); + + networkRollback0.setNetworkName(""); + networkRollback0.getNetworkName(); + networkRollback0.setNetworkCreated(true); + networkRollback0.setNetworkName(""); + networkRollback0.getPhysicalNetwork(); + networkRollback0.setTenantId(""); + networkRollback0.setNetworkId(""); + assertTrue(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getTenantId(); + networkRollback0.setNetworkStackId((String) null); + networkRollback0.getVlans(); + networkRollback0.setTenantId(""); + networkRollback0.getTenantId(); + networkRollback0.setVlans((List) null); + String string0 = networkRollback0.toString(); + assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0); + + NetworkRollback networkRollback1 = new NetworkRollback(); + assertFalse(networkRollback1.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNeutronNetworkId(""); + networkRollback0.setCloudId(""); + networkRollback0.getTenantId(); + networkRollback0.setTenantId(""); + networkRollback0.setNetworkType("Y=x>wx'"); + networkRollback0.getNeutronNetworkId(); + networkRollback0.getVlans(); + networkRollback0.setVlans((List) null); + networkRollback0.setNetworkStackId("6P7@4aGo &Kd>V"); + networkRollback0.getCloudId(); + NetworkRollback networkRollback1 = new NetworkRollback(); + assertFalse(networkRollback1.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + assertFalse(networkRollback0.getNetworkCreated()); + + networkRollback0.setNetworkCreated(true); + networkRollback0.toString(); + networkRollback0.setNeutronNetworkId("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=true, networkName=null, physicalNetwork=null]"); + networkRollback0.getPhysicalNetwork(); + boolean boolean0 = networkRollback0.getNetworkCreated(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkId(", tenantId="); + networkRollback0.setNetworkId(""); + networkRollback0.setTenantId(", tenantId="); + networkRollback0.setNetworkName("+*"); + networkRollback0.getNetworkName(); + networkRollback0.setNetworkStackId(", tenantId="); + networkRollback0.setCloudId("+*"); + networkRollback0.getCloudId(); + NetworkRollback networkRollback1 = new NetworkRollback(); + assertFalse(networkRollback1.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setPhysicalNetwork("!(>41heY7e"); + networkRollback0.setTenantId("j"); + networkRollback0.setNeutronNetworkId("j"); + networkRollback0.getPhysicalNetwork(); + networkRollback0.getVlans(); + NetworkRollback networkRollback1 = new NetworkRollback(); + networkRollback1.getMsoRequest(); + networkRollback0.setMsoRequest((MsoRequest) null); + networkRollback0.setNetworkCreated(false); + networkRollback0.setNeutronNetworkId("j"); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setPhysicalNetwork(""); + networkRollback0.setNetworkStackId(""); + networkRollback0.setNeutronNetworkId(""); + networkRollback0.getNetworkStackId(); + networkRollback0.getMsoRequest(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setCloudId("7u@lc[l##+g`2V"); + networkRollback0.getVlans(); + networkRollback0.setVlans((List) null); + networkRollback0.setNetworkType(""); + networkRollback0.setCloudId(", physicalNetwork="); + networkRollback0.setPhysicalNetwork(""); + networkRollback0.setNeutronNetworkId(", physicalNetwork="); + networkRollback0.getPhysicalNetwork(); + networkRollback0.getNeutronNetworkId(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getNetworkId(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getMsoRequest(); + networkRollback0.setMsoRequest((MsoRequest) null); + networkRollback0.getNetworkCreated(); + networkRollback0.setNetworkId(", networkName="); + networkRollback0.getNeutronNetworkId(); + networkRollback0.setPhysicalNetwork((String) null); + networkRollback0.getNetworkId(); + NetworkRollback networkRollback1 = new NetworkRollback(); + String string0 = networkRollback1.toString(); + assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0); + + networkRollback1.getVlans(); + networkRollback0.setVlans((List) null); + networkRollback0.getNetworkId(); + networkRollback1.getPhysicalNetwork(); + networkRollback1.setNetworkCreated(false); + assertFalse(networkRollback1.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getNetworkType(); + networkRollback0.setTenantId((String) null); + networkRollback0.setNetworkName(" networkStacId="); + networkRollback0.getCloudId(); + networkRollback0.getTenantId(); + networkRollback0.setNetworkStackId(" networkStacId="); + networkRollback0.setNeutronNetworkId((String) null); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.getNetworkName(); + assertFalse(networkRollback0.getNetworkCreated()); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + NetworkRollback networkRollback0 = new NetworkRollback(); + networkRollback0.setNetworkType("uK+JCvyg\"J(C d.w["); + networkRollback0.setCloudId("uK+JCvyg\"J(C d.w["); + networkRollback0.getNetworkStackId(); + assertFalse(networkRollback0.getNetworkCreated()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java new file mode 100644 index 0000000000..1665732f62 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:55:12 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 NetworkRollbackESTestscaffolding { + + @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.openstack.beans.NetworkRollback"; + 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(NetworkRollbackESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.entity.MsoRequest", + "org.openecomp.mso.openstack.beans.NetworkRollback" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java new file mode 100644 index 0000000000..0ec588ded9 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java @@ -0,0 +1,70 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:49:52 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 PoolESTest extends PoolESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + Pool pool0 = new Pool(); + pool0.setStart("Allocation_pool [start=null, end=null]"); + String string0 = pool0.getStart(); + assertEquals("Allocation_pool [start=null, end=null]", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + Pool pool0 = new Pool(); + pool0.setEnd("Allocation_pool [start=null, end=null]"); + String string0 = pool0.getEnd(); + assertEquals("Allocation_pool [start=null, end=null]", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + Pool pool0 = new Pool(); + String string0 = pool0.getEnd(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + Pool pool0 = new Pool(); + pool0.setStart(""); + String string0 = pool0.getStart(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + Pool pool0 = new Pool(); + String string0 = pool0.toString(); + assertEquals("Allocation_pool [start=null, end=null]", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + Pool pool0 = new Pool(); + pool0.setEnd(""); + String string0 = pool0.getEnd(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + Pool pool0 = new Pool(); + String string0 = pool0.getStart(); + assertNull(string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java new file mode 100644 index 0000000000..8ce9cb88b7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:49:52 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 PoolESTestscaffolding { + + @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.openstack.beans.Pool"; + 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(PoolESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.beans.Pool" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java new file mode 100644 index 0000000000..7be8339439 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java @@ -0,0 +1,221 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:52:14 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +import org.junit.Test; +import static org.junit.Assert.*; + +import java.util.List; +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 SubnetESTest extends SubnetESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setSubnetName("lu[c8x"); + subnet0.getSubnetName(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setSubnetName(""); + subnet0.getSubnetName(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setSubnetId("nL"); + subnet0.getSubnetId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setSubnetId(""); + subnet0.getSubnetId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setNeutronId("`jC)vXXeOG"); + subnet0.getNeutronId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setIpVersion(""); + String string0 = subnet0.getIpVersion(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setGatewayIp((String) null); + subnet0.getGatewayIp(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setGatewayIp("Subnet [subnetName=null, neutronId=null, subnetId=null, cidr=null, gatewayIp=, ipVersion=4, enableDHCP=false, hostRoutes=null, allocationPools=null, dnsNameServers=null]"); + subnet0.getGatewayIp(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setCidr("H3%q_*bOC2"); + subnet0.getCidr(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setIpVersion((String) null); + String string0 = subnet0.getIpVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setAllocationPools((List) null); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getNeutronId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getHostRoutes(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + Subnet subnet0 = new Subnet(); + String string0 = subnet0.toString(); + assertEquals("Subnet [subnetName=null, neutronId=null, subnetId=null, cidr=null, gatewayIp=, ipVersion=4, enableDHCP=false, hostRoutes=null, allocationPools=null, dnsNameServers=null]", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getSubnetName(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setNeutronId(""); + subnet0.getNeutronId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setCidr(""); + subnet0.getCidr(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getDnsNameServers(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setHostRoutes((List) null); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Subnet subnet0 = new Subnet(); + String string0 = subnet0.getIpVersion(); + assertEquals("4", string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getSubnetId(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setEnableDHCP((Boolean) null); + subnet0.getEnableDHCP(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getAllocationPools(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getCidr(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.getGatewayIp(); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Subnet subnet0 = new Subnet(); + subnet0.setDnsNameServers((List) null); + assertEquals("4", subnet0.getIpVersion()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + Subnet subnet0 = new Subnet(); + Boolean boolean0 = subnet0.getEnableDHCP(); + assertFalse(boolean0); + assertEquals("4", subnet0.getIpVersion()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java new file mode 100644 index 0000000000..a9bf598355 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:52:14 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 SubnetESTestscaffolding { + + @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.openstack.beans.Subnet"; + 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(SubnetESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.beans.Pool", + "org.openecomp.mso.openstack.beans.Subnet" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java new file mode 100644 index 0000000000..e76ce410d4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java @@ -0,0 +1,403 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:51:17 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import org.openecomp.mso.entity.MsoRequest; +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 VnfRollbackESTest extends VnfRollbackESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupName(", vnfCreated="); + vnfRollback0.getVolumeGroupName(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupId("}mvn2f6!r5FG1/_M~M"); + vnfRollback0.getVolumeGroupId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupId(""); + vnfRollback0.getVolumeGroupId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupHeatStackId("Z^t$4-eOKP9"); + vnfRollback0.getVolumeGroupHeatStackId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVnfId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVnfId(""); + vnfRollback0.getVnfId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVfModuleStackId("8y*`!>A$@*l8#a>"); + vnfRollback0.getVfModuleStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVfModuleStackId(""); + vnfRollback0.getVfModuleStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); + String string0 = vnfRollback0.getTenantId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertEquals(", tenant=", vnfRollback0.getCloudSiteId()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + assertEquals(", tenant=", vnfRollback0.getRequestType()); + assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); + assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); + assertEquals(", tenant=", vnfRollback0.getVnfId()); + assertEquals(", tenant=", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setTenantId(""); + vnfRollback0.getTenantId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + assertFalse(vnfRollback0.getTenantCreated()); + + vnfRollback0.setTenantCreated(true); + boolean boolean0 = vnfRollback0.getTenantCreated(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); + VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud="); + String string0 = vnfRollback0.getRequestType(); + assertFalse(vnfRollback0.isBase()); + assertEquals("Jvr", vnfRollback0.getCloudSiteId()); + assertEquals("", vnfRollback0.getVnfId()); + assertFalse(vnfRollback0.getTenantCreated()); + assertEquals("f'D", vnfRollback0.getVolumeGroupId()); + assertEquals(", vnf=", vnfRollback0.getTenantId()); + assertEquals("VnfRollback: cloud=", string0); + assertFalse(vnfRollback0.getVnfCreated()); + assertEquals("", vnfRollback0.getVolumeGroupName()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setRequestType(""); + vnfRollback0.getRequestType(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); + doReturn("Jvr").when(msoRequest0).toString(); + VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud="); + vnfRollback0.getMsoRequest(); + assertEquals("Jvr", vnfRollback0.getCloudSiteId()); + assertEquals("", vnfRollback0.getVnfId()); + assertFalse(vnfRollback0.isBase()); + assertEquals(", vnf=", vnfRollback0.getTenantId()); + assertEquals("", vnfRollback0.getVolumeGroupName()); + assertEquals("f'D", vnfRollback0.getVolumeGroupId()); + assertEquals("VnfRollback: cloud=", vnfRollback0.getRequestType()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); + String string0 = vnfRollback0.getCloudSiteId(); + assertFalse(vnfRollback0.isBase()); + assertEquals(", tenant=", string0); + assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); + assertFalse(vnfRollback0.getVnfCreated()); + assertEquals(", tenant=", vnfRollback0.getVnfId()); + assertFalse(vnfRollback0.getTenantCreated()); + assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); + assertEquals(", tenant=", vnfRollback0.getRequestType()); + assertEquals(", tenant=", vnfRollback0.getTenantId()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setCloudSiteId(""); + vnfRollback0.getCloudSiteId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setBaseGroupHeatStackId("3(6Q^)Ic kf:zj"); + vnfRollback0.getBaseGroupHeatStackId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setBaseGroupHeatStackId(""); + vnfRollback0.getBaseGroupHeatStackId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + assertFalse(vnfRollback0.isBase()); + + vnfRollback0.setIsBase(true); + boolean boolean0 = vnfRollback0.isBase(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVfModuleStackId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVolumeGroupName(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupName(""); + vnfRollback0.getVolumeGroupName(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + boolean boolean0 = vnfRollback0.getTenantCreated(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(boolean0); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + boolean boolean0 = vnfRollback0.isBase(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + String string0 = vnfRollback0.toString(); + assertFalse(vnfRollback0.isBase()); + assertEquals("VnfRollback: cloud=null, tenant=null, vnf=null, tenantCreated=false, vnfCreated=false, requestType = null", string0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + boolean boolean0 = vnfRollback0.getVnfCreated(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(boolean0); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVolumeGroupHeatStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getBaseGroupHeatStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getCloudSiteId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getTenantId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); + vnfRollback0.setMsoRequest(msoRequest0); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getMsoRequest(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + assertFalse(vnfRollback0.getVnfCreated()); + + vnfRollback0.setVnfCreated(true); + boolean boolean0 = vnfRollback0.getVnfCreated(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVolumeGroupId(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getRequestType(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupHeatStackId(""); + vnfRollback0.getVolumeGroupHeatStackId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); + String string0 = vnfRollback0.getVnfId(); + assertEquals(", tenant=", string0); + assertEquals(", tenant=", vnfRollback0.getTenantId()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertEquals(", tenant=", vnfRollback0.getCloudSiteId()); + assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); + assertEquals(", tenant=", vnfRollback0.getRequestType()); + assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java new file mode 100644 index 0000000000..e07b2cfee3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java @@ -0,0 +1,79 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:51:17 GMT 2016 + */ + +package org.openecomp.mso.openstack.beans; + +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 VnfRollbackESTestscaffolding { + + @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.openstack.beans.VnfRollback"; + 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(VnfRollbackESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.beans.VnfRollback", + "org.openecomp.mso.entity.MsoRequest" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java new file mode 100644 index 0000000000..ccc5a949b7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java @@ -0,0 +1,24 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:51:02 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoAdapterExceptionESTest extends MsoAdapterExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoAdapterException msoAdapterException0 = new MsoAdapterException(""); + MsoAdapterException msoAdapterException1 = new MsoAdapterException("", (Throwable) msoAdapterException0); + assertFalse(msoAdapterException1.equals((Object)msoAdapterException0)); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java new file mode 100644 index 0000000000..657b8b28c4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java @@ -0,0 +1,87 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:51:02 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoAdapterExceptionESTestscaffolding { + + @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.openstack.exceptions.MsoAdapterException"; + 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(MsoAdapterExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoAdapterException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoAdapterExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoAdapterException" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java new file mode 100644 index 0000000000..f840c12025 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java @@ -0,0 +1,30 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:56:48 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoCloudSiteNotFoundESTest extends MsoCloudSiteNotFoundESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound(); + assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound0.getCategory()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound("NQz5T^"); + String string0 = msoCloudSiteNotFound0.toString(); + assertEquals("Cloud Site [NQz5T^] not found", string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java new file mode 100644 index 0000000000..ba287051dd --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java @@ -0,0 +1,87 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:56:48 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoCloudSiteNotFoundESTestscaffolding { + + @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.openstack.exceptions.MsoCloudSiteNotFound"; + 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(MsoCloudSiteNotFoundESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound", + "org.openecomp.mso.openstack.exceptions.MsoException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoCloudSiteNotFoundESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java new file mode 100644 index 0000000000..2bd71fb525 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java @@ -0,0 +1,77 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:48:01 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoExceptionESTest extends MsoExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoTenantNotFound msoTenantNotFound0 = new MsoTenantNotFound("T&~q", "Cloud Site ["); + MsoIOException msoIOException0 = new MsoIOException("", (Throwable) msoTenantNotFound0); + String string0 = msoIOException0.getContextMessage(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("", "", ""); + msoNetworkNotFound0.addContext(""); + String string0 = msoNetworkNotFound0.getContext(); + assertEquals("", string0); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + MsoAdapterException msoAdapterException0 = new MsoAdapterException(" "); + msoAdapterException0.setContext(" "); + String string0 = msoAdapterException0.getContextMessage(); + assertEquals("[ ] ", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound(); + MsoAdapterException msoAdapterException0 = new MsoAdapterException("", (Throwable) msoCloudSiteNotFound0); + msoAdapterException0.addContext(""); + msoAdapterException0.addContext(""); + String string0 = msoAdapterException0.getContext(); + assertEquals(":", msoAdapterException0.getContext()); + assertNotNull(string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound((String) null); + MsoExceptionCategory msoExceptionCategory0 = msoCloudSiteNotFound0.getCategory(); + MsoAdapterException msoAdapterException0 = new MsoAdapterException((String) null, (Throwable) msoCloudSiteNotFound0); + msoAdapterException0.setCategory(msoExceptionCategory0); + assertNull(msoAdapterException0.getContext()); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("", "", ""); + String string0 = msoNetworkNotFound0.getContext(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound((String) null); + MsoAdapterException msoAdapterException0 = new MsoAdapterException((String) null, (Throwable) msoCloudSiteNotFound0); + String string0 = msoAdapterException0.getContextMessage(); + assertNull(string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java new file mode 100644 index 0000000000..8ce85b76bf --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java @@ -0,0 +1,101 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:48:01 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoExceptionESTestscaffolding { + + @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.openstack.exceptions.MsoException"; + 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(MsoExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound", + "org.openecomp.mso.openstack.exceptions.MsoIOException", + "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound", + "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoAdapterException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound", + "org.openecomp.mso.openstack.exceptions.MsoIOException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException", + "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists", + "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound", + "org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists", + "org.openecomp.mso.openstack.exceptions.MsoStackNotFound", + "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound", + "org.openecomp.mso.openstack.exceptions.MsoAdapterException", + "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists", + "org.openecomp.mso.openstack.exceptions.MsoException" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java new file mode 100644 index 0000000000..ec2699c3f3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java @@ -0,0 +1,24 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:50:20 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoIOExceptionESTest extends MsoIOExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoIOException msoIOException0 = new MsoIOException(""); + MsoIOException msoIOException1 = new MsoIOException("", (Throwable) msoIOException0); + assertNull(msoIOException1.getContext()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java new file mode 100644 index 0000000000..e657718fc4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java @@ -0,0 +1,87 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:50:20 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoIOExceptionESTestscaffolding { + + @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.openstack.exceptions.MsoIOException"; + 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(MsoIOExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoIOException", + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoIOExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoIOException" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java new file mode 100644 index 0000000000..2c423b7405 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java @@ -0,0 +1,23 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:52:37 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoNetworkAlreadyExistsESTest extends MsoNetworkAlreadyExistsESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoNetworkAlreadyExists msoNetworkAlreadyExists0 = new MsoNetworkAlreadyExists((String) null, (String) null, (String) null); + assertNull(msoNetworkAlreadyExists0.getContext()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java new file mode 100644 index 0000000000..1c00ba9d8d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java @@ -0,0 +1,89 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:52:37 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoNetworkAlreadyExistsESTestscaffolding { + + @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.openstack.exceptions.MsoNetworkAlreadyExists"; + 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(MsoNetworkAlreadyExistsESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoNetworkAlreadyExistsESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException", + "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java new file mode 100644 index 0000000000..418545056c --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java @@ -0,0 +1,23 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:54:45 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoNetworkNotFoundESTest extends MsoNetworkNotFoundESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("6", "6", "yX9(}I;;7\u00018.eW8", "Q]>\u00018.eW8"); + assertEquals(MsoExceptionCategory.OPENSTACK, msoTenantAlreadyExists0.getCategory()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java new file mode 100644 index 0000000000..11700e6e75 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java @@ -0,0 +1,89 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:56:00 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoTenantAlreadyExistsESTestscaffolding { + + @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.openstack.exceptions.MsoTenantAlreadyExists"; + 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(MsoTenantAlreadyExistsESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoTenantAlreadyExistsESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException", + "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java new file mode 100644 index 0000000000..b65bd1f5e4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java @@ -0,0 +1,23 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:52:17 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoTenantNotFoundESTest extends MsoTenantNotFoundESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + MsoTenantNotFound msoTenantNotFound0 = new MsoTenantNotFound("", ""); + assertEquals(MsoExceptionCategory.OPENSTACK, msoTenantNotFound0.getCategory()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java new file mode 100644 index 0000000000..bd45ba62ad --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java @@ -0,0 +1,89 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:52:17 GMT 2016 + */ + +package org.openecomp.mso.openstack.exceptions; + +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 MsoTenantNotFoundESTestscaffolding { + + @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.openstack.exceptions.MsoTenantNotFound"; + 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(MsoTenantNotFoundESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound", + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoTenantNotFoundESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory", + "org.openecomp.mso.openstack.exceptions.MsoException", + "org.openecomp.mso.openstack.exceptions.MsoOpenstackException", + "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound" + ); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java new file mode 100644 index 0000000000..6eaac45a43 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java @@ -0,0 +1,562 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:40:12 GMT 2016 + */ + +package org.openecomp.mso.openstack.utils; + +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.openecomp.mso.db.catalog.beans.HeatTemplateParam; + +import java.util.LinkedHashSet; +import java.util.Set; +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 MsoHeatEnvironmentEntryESTest { + + @Test(timeout = 4000) + public void test00() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + doReturn((-237540137)).when(set0).size(); + msoHeatEnvironmentEntry0.setResources(set0); + boolean boolean0 = msoHeatEnvironmentEntry0.hasResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + PrivateAccess.setVariable((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "valid", (Object) false); + boolean boolean0 = msoHeatEnvironmentEntry0.isValid(); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setResources(linkedHashSet0); + msoHeatEnvironmentEntry0.getResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("9>KEckx", "8&T!e[SABZ"); + msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0); + msoHeatEnvironmentEntry0.getResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + StringBuilder stringBuilder0 = msoHeatEnvironmentEntry0.toFullString(); + PrivateAccess.setVariable((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "rawEntry", (Object) stringBuilder0); + StringBuilder stringBuilder1 = msoHeatEnvironmentEntry0.getRawEntry(); + assertEquals("\nnull", stringBuilder1.toString()); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + msoHeatEnvironmentEntry0.getParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.getParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setResources(linkedHashSet0); + msoHeatEnvironmentEntry0.getNumberOfResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0); + msoHeatEnvironmentEntry0.getNumberOfResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + doReturn(0).when(set0).size(); + msoHeatEnvironmentEntry0.setResources(set0); + msoHeatEnvironmentEntry0.getNumberOfResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + msoHeatEnvironmentEntry0.getNumberOfParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.getNumberOfParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + PrivateAccess.setVariable((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "errorString", (Object) "Param="); + msoHeatEnvironmentEntry0.getErrorString(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + doReturn((-2945)).when(set0).size(); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(set0); + fail("Expecting exception: IllegalArgumentException"); + + } catch(IllegalArgumentException e) { + // + // Illegal Capacity: -2945 + // + verifyException("java.util.ArrayList", e); + } + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + linkedHashSet0.add((MsoHeatEnvironmentParameter) null); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.toFullString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e); + } + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.containsParameter((String) null, ""); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e); + } + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + linkedHashSet0.add(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.containsParameter((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e); + } + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0); + MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource(); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource1); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentResource", e); + } + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter(); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter1); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e); + } + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("", ""); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter(""); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + boolean boolean0 = msoHeatEnvironmentEntry0.hasParameters(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.hasParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + boolean boolean0 = msoHeatEnvironmentEntry0.hasParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + PrivateAccess.callMethod((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "getResourceRegistryRawEntry"); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentParameter0.setValue("_BAD"); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + assertTrue(msoHeatEnvironmentEntry0.hasParameters()); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentParameter0.setValue("t'N`.KI:L9"); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + assertTrue(msoHeatEnvironmentEntry0.hasParameters()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + assertTrue(msoHeatEnvironmentEntry0.hasParameters()); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam(); + linkedHashSet0.add(heatTemplateParam0); + msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + assertFalse(msoHeatEnvironmentEntry0.hasParameters()); + + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + StringBuilder stringBuilder0 = msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0); + PrivateAccess.setVariable((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "rawEntry", (Object) stringBuilder0); + StringBuilder stringBuilder1 = (StringBuilder)PrivateAccess.callMethod((Class) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "getResourceRegistryRawEntry"); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertNull(stringBuilder1); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("9MTP2Qt0FH.^", ""); + assertTrue(boolean0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("dP:* hj", "dP:* hj"); + assertFalse(boolean0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("", ""); + assertTrue(boolean0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = mock(MsoHeatEnvironmentParameter.class, new ViolatedAssumptionAnswer()); + linkedHashSet0.add(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("kz`LZx"); + assertTrue(msoHeatEnvironmentEntry0.hasParameters()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("kz`LZx"); + assertFalse(boolean0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter(",=?%4z"); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + LinkedHashSet linkedHashSet0 = new LinkedHashSet(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = mock(MsoHeatEnvironmentParameter.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(msoHeatEnvironmentParameter0).getName(); + doReturn((String) null).when(msoHeatEnvironmentParameter0).getValue(); + linkedHashSet0.add(msoHeatEnvironmentParameter0); + msoHeatEnvironmentEntry0.setParameters(linkedHashSet0); + msoHeatEnvironmentEntry0.toFullString(); + assertTrue(msoHeatEnvironmentEntry0.hasParameters()); + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(""); + msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0); + boolean boolean0 = msoHeatEnvironmentEntry0.hasResources(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); + doReturn(0).when(set0).size(); + msoHeatEnvironmentEntry0.setResources(set0); + boolean boolean0 = msoHeatEnvironmentEntry0.hasResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + boolean boolean0 = msoHeatEnvironmentEntry0.hasResources(); + assertFalse(boolean0); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.setResources((Set) null); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.setParameters((Set) null); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + + @Test(timeout = 4000) + public void test43() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.getNumberOfResources(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e); + } + } + + @Test(timeout = 4000) + public void test44() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + boolean boolean0 = msoHeatEnvironmentEntry0.isValid(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test45() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry((StringBuilder) null); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test46() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + // Undeclared exception! + try { + msoHeatEnvironmentEntry0.getNumberOfParameters(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e); + } + } + + @Test(timeout = 4000) + public void test47() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.getRawEntry(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test48() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.getParameters(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test49() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.getResources(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } + + @Test(timeout = 4000) + public void test50() throws Throwable { + MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry(); + msoHeatEnvironmentEntry0.getErrorString(); + assertTrue(msoHeatEnvironmentEntry0.isValid()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java new file mode 100644 index 0000000000..6ec389b809 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java @@ -0,0 +1,129 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:45:40 GMT 2016 + */ + +package org.openecomp.mso.openstack.utils; + +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 MsoHeatEnvironmentParameterESTest extends MsoHeatEnvironmentParameterESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + msoHeatEnvironmentParameter0.hashCode(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + boolean boolean0 = msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentParameter0.setValue(""); + String string0 = msoHeatEnvironmentParameter0.getValue(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + String string0 = msoHeatEnvironmentParameter0.getName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("<*+ogA@v;MO4'8{1"); + String string0 = msoHeatEnvironmentParameter0.getName(); + assertEquals("<*+ogA@v;MO4'8{1", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + String string0 = msoHeatEnvironmentParameter0.getName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("", "-3Y=_MqzpVL7|^$8"); + String string0 = msoHeatEnvironmentParameter0.getValue(); + assertEquals("-3Y=_MqzpVL7|^$8", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter("{Ox?zu\"*"); + boolean boolean0 = msoHeatEnvironmentParameter1.equals(msoHeatEnvironmentParameter0); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("?.@!au:}y7xGSg|}8"); + boolean boolean0 = msoHeatEnvironmentParameter0.equals("?.@!au:}y7xGSg|}8"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentParameter0.setName(""); + assertEquals("", msoHeatEnvironmentParameter0.getName()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter(""); + boolean boolean0 = msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter1); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + String string0 = msoHeatEnvironmentParameter0.getValue(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + msoHeatEnvironmentParameter0.hashCode(); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(); + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter(); + // Undeclared exception! + try { + msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter1); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter(""); + String string0 = msoHeatEnvironmentParameter0.toString(); + assertEquals(": null", string0); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java new file mode 100644 index 0000000000..f7e33bb8ce --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:45:40 GMT 2016 + */ + +package org.openecomp.mso.openstack.utils; + +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 MsoHeatEnvironmentParameterESTestscaffolding { + + @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.openstack.utils.MsoHeatEnvironmentParameter"; + 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(MsoHeatEnvironmentParameterESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter" + ); + } + + private static void resetClasses() { + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java new file mode 100644 index 0000000000..d3e7d29717 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java @@ -0,0 +1,129 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Nov 14 08:45:54 GMT 2016 + */ + +package org.openecomp.mso.openstack.utils; + +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 MsoHeatEnvironmentResourceESTest extends MsoHeatEnvironmentResourceESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", ""); + msoHeatEnvironmentResource0.hashCode(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("8{,8]8v", "8{,8]8v"); + String string0 = msoHeatEnvironmentResource0.getValue(); + assertEquals("8{,8]8v", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", ""); + String string0 = msoHeatEnvironmentResource0.getValue(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("\"(_{*)._$D2+w8wk"); + String string0 = msoHeatEnvironmentResource0.getName(); + assertEquals("\"(_{*)._$D2+w8wk", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource(); + // Undeclared exception! + try { + msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", ""); + MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource("", ""); + boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("m"); + MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource("l", "l"); + boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + boolean boolean0 = msoHeatEnvironmentResource0.equals("1Z^#74OJV(OBf<=#r"); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource0); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + String string0 = msoHeatEnvironmentResource0.getName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + msoHeatEnvironmentResource0.setName(""); + String string0 = msoHeatEnvironmentResource0.getName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(""); + String string0 = msoHeatEnvironmentResource0.getValue(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + msoHeatEnvironmentResource0.hashCode(); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + String string0 = msoHeatEnvironmentResource0.toString(); + assertEquals("\"null\": null", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource(); + msoHeatEnvironmentResource0.setValue(""); + assertNull(msoHeatEnvironmentResource0.getName()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java new file mode 100644 index 0000000000..3917b8904c --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Nov 14 08:45:54 GMT 2016 + */ + +package org.openecomp.mso.openstack.utils; + +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 MsoHeatEnvironmentResourceESTestscaffolding { + + @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.openstack.utils.MsoHeatEnvironmentResource"; + 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(MsoHeatEnvironmentResourceESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentResource" + ); + } + + private static void resetClasses() { + } +} -- cgit 1.2.3-korg