diff options
author | 2017-01-31 11:40:03 +0100 | |
---|---|---|
committer | 2017-01-31 12:59:33 +0100 | |
commit | 025301d08b061482c1f046d562bf017c8cbcfe8d (patch) | |
tree | 68a2a549736c9bf0f7cd4e71c76e40ef7e2606f2 /asdc-controller/src/test/java/org/openecomp/mso/asdc/installer | |
parent | 2754ad52f833278a5c925bd788a16d1dce16a598 (diff) |
Initial OpenECOMP MSO commit
Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d
Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'asdc-controller/src/test/java/org/openecomp/mso/asdc/installer')
10 files changed, 1400 insertions, 0 deletions
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java new file mode 100644 index 0000000000..8dd5afe7e0 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java @@ -0,0 +1,139 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Nov 25 13:35:55 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import java.util.List; +import java.util.Map; +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; +import org.openecomp.sdc.api.notification.IArtifactInfo; +import org.openecomp.sdc.api.notification.INotificationData; +import org.openecomp.sdc.api.notification.IResourceInstance; +import org.openecomp.sdc.api.notification.IVfModuleMetadata; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ASDCElementInfoESTest extends ASDCElementInfoESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iResourceInstance0).getResourceInstanceName(); + doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID(); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0); + String string0 = aSDCElementInfo0.getType(); + assertEquals("VNF_RESOURCE", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null); + Map<String, String> map0 = aSDCElementInfo0.getElementInfoMap(); + assertTrue(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Map<String, String> map0 = ASDCElementInfo.EMPTY_INSTANCE.getElementInfoMap(); + assertTrue(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE; + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iArtifactInfo0).getArtifactName(); + doReturn((String) null).when(iArtifactInfo0).getArtifactType(); + doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); + ASDCElementInfo aSDCElementInfo1 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0); + aSDCElementInfo0.toString(); + PrivateAccess.setVariable((Class<ASDCElementInfo>) ASDCElementInfo.class, aSDCElementInfo1, "elementInfoMap", (Object) null); + aSDCElementInfo0.toString(); + // Undeclared exception! + try { + aSDCElementInfo1.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.ASDCElementInfo", e); + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE; + aSDCElementInfo0.addElementInfo("V$", (String) null); + assertEquals("", aSDCElementInfo0.getType()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null); + String string0 = aSDCElementInfo0.EMPTY_INSTANCE.getType(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, (IResourceInstance) null); + IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + doReturn(" Name").when(iResourceInstance0).getResourceInstanceName(); + doReturn(" Name").when(iResourceInstance0).getResourceInvariantUUID(); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0); + String string0 = aSDCElementInfo0.toString(); + assertEquals("Resource Instance Invariant UUID: Name, Resource Instance Name: Name", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo((IArtifactInfo) null); + aSDCElementInfo0.addElementInfo((String) null, ""); + assertEquals("", aSDCElementInfo0.getType()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iArtifactInfo0).getArtifactName(); + doReturn((String) null).when(iArtifactInfo0).getArtifactType(); + doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); + ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0); + String string0 = aSDCElementInfo0.getType(); + assertNull(string0); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java new file mode 100644 index 0000000000..075970b066 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java @@ -0,0 +1,100 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Nov 25 13:35:55 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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 ASDCElementInfoESTestscaffolding { + + @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.asdc.installer.ASDCElementInfo"; + 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(ASDCElementInfoESTestscaffolding.class.getClassLoader() , + "org.openecomp.sdc.api.IDistributionClient", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.asdc.installer.VfResourceStructure", + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.sdc.api.notification.IVfModuleMetadata", + "org.openecomp.mso.db.catalog.beans.VfModule", + "org.openecomp.sdc.api.results.IDistributionClientResult", + "org.openecomp.sdc.api.notification.IArtifactInfo", + "org.openecomp.mso.db.catalog.beans.Service", + "org.openecomp.mso.asdc.installer.VfModuleStructure", + "org.openecomp.sdc.api.notification.INotificationData", + "org.openecomp.mso.asdc.installer.VfModuleArtifact", + "org.openecomp.sdc.api.notification.IResourceInstance", + "org.openecomp.mso.asdc.installer.ASDCElementInfo", + "org.openecomp.sdc.api.results.IDistributionClientDownloadResult", + "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ASDCElementInfoESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum", + "org.openecomp.mso.asdc.installer.ASDCElementInfo", + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException" + ); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTest.java new file mode 100644 index 0000000000..4675f05477 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTest.java @@ -0,0 +1,138 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Nov 25 13:37:47 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; + +import java.math.BigDecimal; +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 BigDecimalVersionESTest extends BigDecimalVersionESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + String string0 = BigDecimalVersion.castAndCheckNotificationVersionToString("9"); + assertEquals("9", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + BigDecimal bigDecimal0 = BigDecimalVersion.castAndCheckNotificationVersion("0"); + assertEquals(0, bigDecimal0.shortValue()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + BigDecimal bigDecimal0 = BigDecimalVersion.castAndCheckNotificationVersion("9"); + assertEquals(9, bigDecimal0.byteValue()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + BigDecimal bigDecimal0 = BigDecimalVersion.castAndCheckNotificationVersion("-1"); + assertEquals(-1, bigDecimal0.byteValue()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersionToString("fgt+&6@pL9`5EE}.!.,"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("java.math.BigDecimal", e); + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersionToString((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.BigDecimalVersion", e); + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersion((String) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.BigDecimalVersion", e); + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersion("."); + fail("Expecting exception: ArrayIndexOutOfBoundsException"); + + } catch(ArrayIndexOutOfBoundsException e) { + // + // 0 + // + verifyException("org.openecomp.mso.asdc.installer.BigDecimalVersion", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersion("Mf**K`5E.~Fu.,q"); + fail("Expecting exception: NumberFormatException"); + + } catch(NumberFormatException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("java.math.BigDecimal", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + BigDecimalVersion bigDecimalVersion0 = new BigDecimalVersion(); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + // Undeclared exception! + try { + BigDecimalVersion.castAndCheckNotificationVersionToString("."); + fail("Expecting exception: ArrayIndexOutOfBoundsException"); + + } catch(ArrayIndexOutOfBoundsException e) { + // + // 0 + // + verifyException("org.openecomp.mso.asdc.installer.BigDecimalVersion", e); + } + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTestscaffolding.java new file mode 100644 index 0000000000..c04ada8396 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/BigDecimalVersionESTestscaffolding.java @@ -0,0 +1,77 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Nov 25 13:37:47 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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 BigDecimalVersionESTestscaffolding { + + @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.asdc.installer.BigDecimalVersion"; + 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(BigDecimalVersionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.asdc.installer.BigDecimalVersion" + ); + } + + private static void resetClasses() { + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTest.java new file mode 100644 index 0000000000..c9b29ae57f --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTest.java @@ -0,0 +1,154 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Nov 25 13:20:32 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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; +import org.openecomp.sdc.api.notification.IArtifactInfo; +import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; +import org.openecomp.sdc.impl.DistributionClientDownloadResultImpl; +import org.openecomp.sdc.utils.DistributionActionResultEnum; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class VfModuleArtifactESTest extends VfModuleArtifactESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.CONF_MISSING_ARTIFACT_TYPES; + byte[] byteArray0 = new byte[1]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "7pKd8", "7pKd8", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + PrivateAccess.setVariable((Class<VfModuleArtifact>) VfModuleArtifact.class, vfModuleArtifact0, "result", (Object) null); + vfModuleArtifact0.getResult(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_ALREADY_INITIALIZED; + byte[] byteArray0 = new byte[0]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "o<Q", "o<Q", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.getResult(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_ALREADY_INITIALIZED; + byte[] byteArray0 = new byte[0]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "o<Q", "o<Q", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.incrementDeployedInDB(); + int int0 = vfModuleArtifact0.getDeployedInDb(); + assertEquals(1, int0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.CONF_MISSING_ASDC_FQDN; + byte[] byteArray0 = new byte[2]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "qZr'D", "qZr'D", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + PrivateAccess.setVariable((Class<VfModuleArtifact>) VfModuleArtifact.class, vfModuleArtifact0, "deployedInDb", (Object) (-40)); + int int0 = vfModuleArtifact0.getDeployedInDb(); + assertEquals((-40), int0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_ALREADY_INITIALIZED; + byte[] byteArray0 = new byte[0]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "o<Q", "o<Q", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.setCatalogObject(byteArray0); + vfModuleArtifact0.getCatalogObject(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("o<Q").when(iArtifactInfo0).toString(); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_ALREADY_INITIALIZED; + byte[] byteArray0 = new byte[0]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "o<Q", "o<Q", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.getArtifactInfo(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VfModuleArtifact vfModuleArtifact0 = null; + try { + vfModuleArtifact0 = new VfModuleArtifact((IArtifactInfo) null, (IDistributionClientDownloadResult) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleArtifact", e); + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_ALREADY_INITIALIZED; + byte[] byteArray0 = new byte[0]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "o<Q", "o<Q", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.getCatalogObject(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.CONF_MISSING_ARTIFACT_TYPES; + byte[] byteArray0 = new byte[1]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "7pKd8", "7pKd8", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.getResult(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.CONF_MISSING_ASDC_FQDN; + byte[] byteArray0 = new byte[2]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "qZr'D", "qZr'D", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact(iArtifactInfo0, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + int int0 = vfModuleArtifact0.getDeployedInDb(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.DISTRIBUTION_CLIENT_IS_TERMINATED; + byte[] byteArray0 = new byte[5]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "", "", byteArray0); + VfModuleArtifact vfModuleArtifact0 = new VfModuleArtifact((IArtifactInfo) null, (IDistributionClientDownloadResult) distributionClientDownloadResultImpl0); + vfModuleArtifact0.getArtifactInfo(); + assertEquals(0, vfModuleArtifact0.getDeployedInDb()); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTestscaffolding.java new file mode 100644 index 0000000000..75c5f1588f --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleArtifactESTestscaffolding.java @@ -0,0 +1,83 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Nov 25 13:20:32 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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 VfModuleArtifactESTestscaffolding { + + @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.asdc.installer.VfModuleArtifact"; + 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(VfModuleArtifactESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.asdc.installer.VfModuleArtifact", + "org.openecomp.sdc.utils.DistributionActionResultEnum", + "org.openecomp.sdc.impl.DistributionClientResultImpl", + "org.openecomp.sdc.impl.DistributionClientDownloadResultImpl", + "org.openecomp.sdc.api.results.IDistributionClientResult", + "org.openecomp.sdc.api.results.IDistributionClientDownloadResult", + "org.openecomp.sdc.api.notification.IArtifactInfo" + ); + } + + private static void resetClasses() { + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java new file mode 100644 index 0000000000..f3c20c5eb7 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java @@ -0,0 +1,108 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Nov 25 13:37:00 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.openecomp.sdc.api.notification.INotificationData; +import org.openecomp.sdc.api.notification.IResourceInstance; +import org.openecomp.sdc.api.notification.IVfModuleMetadata; + +import java.util.LinkedList; +import java.util.List; + +import static org.evosuite.runtime.EvoAssertions.verifyException; +import static org.evosuite.shaded.org.mockito.Mockito.doReturn; +import static org.evosuite.shaded.org.mockito.Mockito.mock; +import static org.junit.Assert.fail; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class VfModuleStructureESTest extends VfModuleStructureESTestscaffolding { + + @Test(timeout = 4000) + public void test1() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleMetadata0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + LinkedList<String> linkedList0 = new LinkedList<String>(); + IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); + doReturn(linkedList0).when(iVfModuleMetadata0).getArtifacts(); + linkedList0.add(""); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); + fail("Expecting exception: Exception"); + + } catch(Exception e) { + // + // Artifact (UUID:) referenced in the VFModule UUID list has not been downloaded, cancelling the Resource deployment + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.setSuccessfulDeployment(); + IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); + vfResourceStructure0.setSuccessfulDeployment(); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTestscaffolding.java new file mode 100644 index 0000000000..f6aa2ab5f2 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTestscaffolding.java @@ -0,0 +1,96 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Nov 25 13:37:00 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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 VfModuleStructureESTestscaffolding { + + @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.asdc.installer.VfModuleStructure"; + 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(VfModuleStructureESTestscaffolding.class.getClassLoader() , + "org.openecomp.sdc.api.IDistributionClient", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.asdc.installer.VfResourceStructure", + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.sdc.api.notification.IVfModuleMetadata", + "org.openecomp.mso.db.catalog.beans.VfModule", + "org.openecomp.sdc.api.results.IDistributionClientResult", + "org.openecomp.sdc.api.notification.IArtifactInfo", + "org.openecomp.mso.db.catalog.beans.Service", + "org.openecomp.mso.asdc.installer.VfModuleStructure", + "org.openecomp.sdc.api.notification.INotificationData", + "org.openecomp.mso.asdc.installer.VfModuleArtifact", + "org.openecomp.sdc.api.notification.IResourceInstance", + "org.openecomp.sdc.api.results.IDistributionClientDownloadResult" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(VfModuleStructureESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException" + ); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java new file mode 100644 index 0000000000..4a27df3a48 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java @@ -0,0 +1,400 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Nov 25 13:29:36 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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.Service; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import java.time.chrono.ChronoLocalDate; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.PrivateAccess; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.evosuite.runtime.mock.java.time.chrono.MockHijrahDate; +import org.junit.runner.RunWith; +import org.openecomp.sdc.api.IDistributionClient; +import org.openecomp.sdc.api.notification.IArtifactInfo; +import org.openecomp.sdc.api.notification.INotificationData; +import org.openecomp.sdc.api.notification.IResourceInstance; +import org.openecomp.sdc.impl.DistributionClientDownloadResultImpl; +import org.openecomp.sdc.impl.mock.DistributionClientDownloadResultStubImpl; +import org.openecomp.sdc.impl.mock.DistributionClientStubImpl; +import org.openecomp.sdc.utils.DistributionActionResultEnum; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class VfResourceStructureESTest extends VfResourceStructureESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) null); + vfResourceStructure0.getVfModuleStructure(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + LinkedList<Object> linkedList0 = new LinkedList<Object>(); + linkedList0.add((Object) vfResourceStructure0); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) linkedList0); + vfResourceStructure0.getVfModuleStructure(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, (IResourceInstance) null); + vfResourceStructure0.getResourceInstance(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("").when(iNotificationData0).toString(); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getNotification(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + Service service0 = new Service(); + service0.setId(6); + vfResourceStructure0.setCatalogService(service0); + vfResourceStructure0.getCatalogService(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer()); + List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((Iterator) null).when(list0).iterator(); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); + List<MockHijrahDate> list1 = (List<MockHijrahDate>) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1); + // Undeclared exception! + try { + vfResourceStructure0.createVfModuleStructures(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer()); + doReturn(false).when(iterator0).hasNext(); + List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(iterator0).when(list0).iterator(); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); + List<MockHijrahDate> list1 = (List<MockHijrahDate>) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1); + vfResourceStructure0.createVfModuleStructures(); + IDistributionClient iDistributionClient0 = mock(IDistributionClient.class, new ViolatedAssumptionAnswer()); + IArtifactInfo iArtifactInfo0 = null; + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.ARTIFACT_NOT_FOUND; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, ""); + List<Object> list2 = (List<Object>) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list2); + // Undeclared exception! + try { + vfResourceStructure0.addArtifactToStructure(iDistributionClient0, (IArtifactInfo) null, distributionClientDownloadResultImpl0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + } + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + ChronoLocalDate chronoLocalDate0 = mock(ChronoLocalDate.class, new ViolatedAssumptionAnswer()); + Iterator<ChronoLocalDate> iterator0 = (Iterator<ChronoLocalDate>) mock(Iterator.class, new ViolatedAssumptionAnswer()); + doReturn(true).when(iterator0).hasNext(); + doReturn(chronoLocalDate0).when(iterator0).next(); + List<ChronoLocalDate> list0 = (List<ChronoLocalDate>) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(iterator0).when(list0).iterator(); + PrivateAccess.setVariable((Class<VfResourceStructure>) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); + // Undeclared exception! + try { + vfResourceStructure0.createVfModuleStructures(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // $java.time.chrono.ChronoLocalDate$$EnhancerByMockitoWithCGLIB$$27d47344 cannot be cast to org.openecomp.sdc.api.notification.IVfModuleMetadata + // + verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + try { + vfResourceStructure0.createVfModuleStructures(); + fail("Expecting exception: Exception"); + + } catch(Exception e) { + // + // VfModule Meta DATA could not be decoded properly or was not present in the notification + // + verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("%[76").when(iArtifactInfo0).getArtifactType(); + DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("HEAT_ARTIFACT").when(iArtifactInfo0).getArtifactType(); + doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); + DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); + IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("HEAT").when(iArtifactInfo1).getArtifactType(); + doReturn("%[76").when(iArtifactInfo1).getArtifactUUID(); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); + IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("HEAT_NET").when(iArtifactInfo1).getArtifactType(); + doReturn("HEAT_ENV").when(iArtifactInfo1).getArtifactUUID(); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("HEAT_ENV").when(iArtifactInfo0).getArtifactType(); + doReturn("*Z\"P4rvOA+mW").when(iArtifactInfo0).getArtifactUUID(); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.UEB_KEYS_CREATION_FAILED; + byte[] byteArray0 = new byte[6]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "]=)|;N.$hV]d^", "s:h+", byteArray0); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0); + Map<String, VfModuleArtifact> map0 = vfResourceStructure0.getArtifactsMapByUUID(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + assertFalse(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("VF_MODULES_METADATA").when(iArtifactInfo0).getArtifactType(); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.BAD_REQUEST; + byte[] byteArray0 = new byte[2]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "<B['", "<B['", byteArray0); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn("HEAT_NESTED").when(iArtifactInfo0).getArtifactType(); + doReturn("HEAT_NESTED").when(iArtifactInfo0).getArtifactUUID(); + DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.BAD_REQUEST; + byte[] byteArray0 = new byte[2]; + DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "<B['", "<B['", byteArray0); + vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getCatalogService(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getVfModulesStructureList(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getArtifactsMapByUUID(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + + vfResourceStructure0.setSuccessfulDeployment(); + boolean boolean0 = vfResourceStructure0.isDeployedSuccessfully(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getCatalogVnfResource(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getVfModuleStructure(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + boolean boolean0 = vfResourceStructure0.isDeployedSuccessfully(); + assertFalse(boolean0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, iResourceInstance0); + vfResourceStructure0.getNotification(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + VnfResource vnfResource0 = new VnfResource(); + vfResourceStructure0.setCatalogVnfResource(vnfResource0); + vfResourceStructure0.getCatalogVnfResource(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + Service service0 = new Service(); + vfResourceStructure0.setCatalogService(service0); + vfResourceStructure0.getCatalogService(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iResourceInstance0).toString(); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + vfResourceStructure0.getResourceInstance(); + assertFalse(vfResourceStructure0.isDeployedSuccessfully()); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java new file mode 100644 index 0000000000..f78949eecc --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java @@ -0,0 +1,105 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Nov 25 13:29:36 GMT 2016 + */ + +package org.openecomp.mso.asdc.installer; + +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 VfResourceStructureESTestscaffolding { + + @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.asdc.installer.VfResourceStructure"; + 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(VfResourceStructureESTestscaffolding.class.getClassLoader() , + "org.openecomp.sdc.api.IDistributionClient", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.asdc.installer.VfResourceStructure", + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.sdc.utils.DistributionActionResultEnum", + "org.openecomp.sdc.impl.DistributionClientResultImpl", + "org.openecomp.sdc.impl.mock.DistributionClientStubImpl", + "org.openecomp.sdc.impl.DistributionClientDownloadResultImpl", + "org.openecomp.sdc.api.consumer.IConfiguration", + "org.openecomp.sdc.api.notification.IVfModuleMetadata", + "org.openecomp.sdc.api.results.IDistributionClientResult", + "org.openecomp.mso.db.catalog.beans.Service", + "org.openecomp.sdc.api.notification.IArtifactInfo", + "org.openecomp.sdc.impl.mock.DistributionClientDownloadResultStubImpl", + "org.openecomp.sdc.api.consumer.INotificationCallback", + "org.openecomp.mso.asdc.installer.VfModuleStructure", + "org.openecomp.sdc.api.notification.INotificationData", + "org.openecomp.mso.asdc.installer.VfModuleArtifact", + "org.openecomp.sdc.api.notification.IResourceInstance", + "org.openecomp.sdc.impl.mock.DistributionClientResultStubImpl", + "org.openecomp.sdc.api.results.IDistributionClientDownloadResult", + "org.openecomp.sdc.api.consumer.IDistributionStatusMessage" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(VfResourceStructureESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException" + ); + } +} |